mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-09-24 07:54:43 +00:00
Merge pull request #905 from agracio/develop
Initial refactoring of dotnet API
This commit is contained in:
@@ -7,7 +7,9 @@ using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.API.Extensions;
|
||||
using static System.Collections.Specialized.BitVector32;
|
||||
using ElectronNET.Common;
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
@@ -39,7 +41,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-window-all-closed-event", GetHashCode());
|
||||
BridgeConnector.Socket.Emit("register-app-window-all-closed", GetHashCode());
|
||||
}
|
||||
_windowAllClosed += value;
|
||||
}
|
||||
@@ -111,7 +113,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-before-quit-event", GetHashCode());
|
||||
BridgeConnector.Socket.Emit("register-app-before-quit", GetHashCode());
|
||||
}
|
||||
_beforeQuit += value;
|
||||
}
|
||||
@@ -162,7 +164,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-will-quit-event", GetHashCode());
|
||||
BridgeConnector.Socket.Emit("register-app-will-quit", GetHashCode());
|
||||
}
|
||||
_willQuit += value;
|
||||
}
|
||||
@@ -197,7 +199,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-will-quit-event", GetHashCode() + "quitting");
|
||||
BridgeConnector.Socket.Emit("register-app-will-quit", GetHashCode() + "quitting");
|
||||
}
|
||||
_quitting += value;
|
||||
}
|
||||
@@ -217,26 +219,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action BrowserWindowBlur
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_browserWindowBlur == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("app-browser-window-blur" + GetHashCode(), () =>
|
||||
{
|
||||
_browserWindowBlur();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-browser-window-blur-event", GetHashCode());
|
||||
}
|
||||
_browserWindowBlur += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_browserWindowBlur -= value;
|
||||
|
||||
if (_browserWindowBlur == null)
|
||||
BridgeConnector.Socket.Off("app-browser-window-blur" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("app-browser-window-blur", GetHashCode(), _browserWindowBlur, value);
|
||||
remove => ApiEventManager.RemoveEvent("app-browser-window-blur", GetHashCode(), _browserWindowBlur, value);
|
||||
}
|
||||
|
||||
private event Action _browserWindowBlur;
|
||||
@@ -246,26 +230,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action BrowserWindowFocus
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_browserWindowFocus == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("app-browser-window-focus" + GetHashCode(), () =>
|
||||
{
|
||||
_browserWindowFocus();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-browser-window-focus-event", GetHashCode());
|
||||
}
|
||||
_browserWindowFocus += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_browserWindowFocus -= value;
|
||||
|
||||
if (_browserWindowFocus == null)
|
||||
BridgeConnector.Socket.Off("app-browser-window-focus" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("app-browser-window-focus", GetHashCode(), _browserWindowFocus, value);
|
||||
remove => ApiEventManager.RemoveEvent("app-browser-window-focus", GetHashCode(), _browserWindowFocus, value);
|
||||
}
|
||||
|
||||
private event Action _browserWindowFocus;
|
||||
@@ -275,26 +241,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action BrowserWindowCreated
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_browserWindowCreated == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("app-browser-window-created" + GetHashCode(), () =>
|
||||
{
|
||||
_browserWindowCreated();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-browser-window-created-event", GetHashCode());
|
||||
}
|
||||
_browserWindowCreated += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_browserWindowCreated -= value;
|
||||
|
||||
if (_browserWindowCreated == null)
|
||||
BridgeConnector.Socket.Off("app-browser-window-created" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("app-browser-window-created", GetHashCode(), _browserWindowCreated, value);
|
||||
remove => ApiEventManager.RemoveEvent("app-browser-window-created", GetHashCode(), _browserWindowCreated, value);
|
||||
}
|
||||
|
||||
private event Action _browserWindowCreated;
|
||||
@@ -304,26 +252,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action WebContentsCreated
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_webContentsCreated == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("app-web-contents-created" + GetHashCode(), () =>
|
||||
{
|
||||
_webContentsCreated();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-web-contents-created-event", GetHashCode());
|
||||
}
|
||||
_webContentsCreated += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_webContentsCreated -= value;
|
||||
|
||||
if (_webContentsCreated == null)
|
||||
BridgeConnector.Socket.Off("app-web-contents-created" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("app-web-contents-created", GetHashCode(), _webContentsCreated, value);
|
||||
remove => ApiEventManager.RemoveEvent("app-web-contents-created", GetHashCode(), _webContentsCreated, value);
|
||||
}
|
||||
|
||||
private event Action _webContentsCreated;
|
||||
@@ -335,26 +265,8 @@ namespace ElectronNET.API
|
||||
/// <returns><see langword="true"/> when Chrome's accessibility support is enabled, <see langword="false"/> otherwise.</returns>
|
||||
public event Action<bool> AccessibilitySupportChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_accessibilitySupportChanged == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("app-accessibility-support-changed" + GetHashCode(), (state) =>
|
||||
{
|
||||
_accessibilitySupportChanged((bool)state);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-accessibility-support-changed-event", GetHashCode());
|
||||
}
|
||||
_accessibilitySupportChanged += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_accessibilitySupportChanged -= value;
|
||||
|
||||
if (_accessibilitySupportChanged == null)
|
||||
BridgeConnector.Socket.Off("app-accessibility-support-changed" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("app-accessibility-support-changed", GetHashCode(), _accessibilitySupportChanged, value, (args) => (bool)args);
|
||||
remove => ApiEventManager.RemoveEvent("app-accessibility-support-changed", GetHashCode(), _accessibilitySupportChanged, value);
|
||||
}
|
||||
|
||||
private event Action<bool> _accessibilitySupportChanged;
|
||||
@@ -408,26 +320,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<string> OpenFile
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_openFile == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("app-open-file" + GetHashCode(), (file) =>
|
||||
{
|
||||
_openFile(file.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-open-file-event", GetHashCode());
|
||||
}
|
||||
_openFile += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_openFile -= value;
|
||||
|
||||
if (_openFile == null)
|
||||
BridgeConnector.Socket.Off("app-open-file" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("app-open-file", GetHashCode(), _openFile, value, (args) => args.ToString());
|
||||
remove => ApiEventManager.RemoveEvent("app-open-file", GetHashCode(), _openFile, value);
|
||||
}
|
||||
|
||||
private event Action<string> _openFile;
|
||||
@@ -439,26 +333,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<string> OpenUrl
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_openUrl == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("app-open-url" + GetHashCode(), (url) =>
|
||||
{
|
||||
_openUrl(url.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-open-url-event", GetHashCode());
|
||||
}
|
||||
_openUrl += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_openUrl -= value;
|
||||
|
||||
if (_openUrl == null)
|
||||
BridgeConnector.Socket.Off("app-open-url" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("app-open-url", GetHashCode(), _openUrl, value, (args) => args.ToString());
|
||||
remove => ApiEventManager.RemoveEvent("app-open-url", GetHashCode(), _openUrl, value);
|
||||
}
|
||||
|
||||
private event Action<string> _openUrl;
|
||||
|
||||
@@ -5,6 +5,8 @@ using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.Common;
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
@@ -286,26 +288,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<string> OnError
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_error == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-error" + GetHashCode(), (message) =>
|
||||
{
|
||||
_error(message.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-error-event", GetHashCode());
|
||||
}
|
||||
_error += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_error -= value;
|
||||
|
||||
if (_error == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-error" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("autoUpdater-error", GetHashCode(), _error, value, (args) => args.ToString());
|
||||
remove => ApiEventManager.RemoveEvent("autoUpdater-error", GetHashCode(), _error, value);
|
||||
}
|
||||
|
||||
private event Action<string> _error;
|
||||
@@ -315,26 +299,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnCheckingForUpdate
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_checkingForUpdate == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-checking-for-update" + GetHashCode(), () =>
|
||||
{
|
||||
_checkingForUpdate();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-checking-for-update-event", GetHashCode());
|
||||
}
|
||||
_checkingForUpdate += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_checkingForUpdate -= value;
|
||||
|
||||
if (_checkingForUpdate == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-checking-for-update" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("autoUpdater-checking-for-update", GetHashCode(), _checkingForUpdate, value);
|
||||
remove => ApiEventManager.RemoveEvent("autoUpdater-checking-for-update", GetHashCode(), _checkingForUpdate, value);
|
||||
}
|
||||
|
||||
private event Action _checkingForUpdate;
|
||||
@@ -345,26 +311,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<UpdateInfo> OnUpdateAvailable
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_updateAvailable == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-update-available" + GetHashCode(), (updateInfo) =>
|
||||
{
|
||||
_updateAvailable(JObject.Parse(updateInfo.ToString()).ToObject<UpdateInfo>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-update-available-event", GetHashCode());
|
||||
}
|
||||
_updateAvailable += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_updateAvailable -= value;
|
||||
|
||||
if (_updateAvailable == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-update-available" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("autoUpdater-update-available", GetHashCode(), _updateAvailable, value, (args) => JObject.Parse(args.ToString()).ToObject<UpdateInfo>());
|
||||
remove => ApiEventManager.RemoveEvent("autoUpdater-update-available", GetHashCode(), _updateAvailable, value);
|
||||
}
|
||||
|
||||
private event Action<UpdateInfo> _updateAvailable;
|
||||
@@ -374,26 +322,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<UpdateInfo> OnUpdateNotAvailable
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_updateNotAvailable == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-update-not-available" + GetHashCode(), (updateInfo) =>
|
||||
{
|
||||
_updateNotAvailable(JObject.Parse(updateInfo.ToString()).ToObject<UpdateInfo>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-update-not-available-event", GetHashCode());
|
||||
}
|
||||
_updateNotAvailable += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_updateNotAvailable -= value;
|
||||
|
||||
if (_updateNotAvailable == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-update-not-available" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("autoUpdater-update-not-available", GetHashCode(), _updateNotAvailable, value, (args) => JObject.Parse(args.ToString()).ToObject<UpdateInfo>());
|
||||
remove => ApiEventManager.RemoveEvent("autoUpdater-update-not-available", GetHashCode(), _updateNotAvailable, value);
|
||||
}
|
||||
|
||||
private event Action<UpdateInfo> _updateNotAvailable;
|
||||
@@ -403,26 +333,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<ProgressInfo> OnDownloadProgress
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_downloadProgress == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-download-progress" + GetHashCode(), (progressInfo) =>
|
||||
{
|
||||
_downloadProgress(JObject.Parse(progressInfo.ToString()).ToObject<ProgressInfo>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-download-progress-event", GetHashCode());
|
||||
}
|
||||
_downloadProgress += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_downloadProgress -= value;
|
||||
|
||||
if (_downloadProgress == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-download-progress" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("autoUpdater-download-progress", GetHashCode(), _downloadProgress, value, (args) => JObject.Parse(args.ToString()).ToObject<ProgressInfo>());
|
||||
remove => ApiEventManager.RemoveEvent("autoUpdater-download-progress", GetHashCode(), _downloadProgress, value);
|
||||
}
|
||||
|
||||
private event Action<ProgressInfo> _downloadProgress;
|
||||
@@ -432,26 +344,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<UpdateInfo> OnUpdateDownloaded
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_updateDownloaded == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-update-downloaded" + GetHashCode(), (updateInfo) =>
|
||||
{
|
||||
_updateDownloaded(JObject.Parse(updateInfo.ToString()).ToObject<UpdateInfo>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-update-downloaded-event", GetHashCode());
|
||||
}
|
||||
_updateDownloaded += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_updateDownloaded -= value;
|
||||
|
||||
if (_updateDownloaded == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-update-downloaded" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("autoUpdater-update-downloaded", GetHashCode(), _updateDownloaded, value, (args) => JObject.Parse(args.ToString()).ToObject<UpdateInfo>());
|
||||
remove => ApiEventManager.RemoveEvent("autoUpdater-update-downloaded", GetHashCode(), _updateDownloaded, value);
|
||||
}
|
||||
|
||||
private event Action<UpdateInfo> _updateDownloaded;
|
||||
|
||||
@@ -8,6 +8,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.Common;
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace ElectronNET.API;
|
||||
|
||||
@@ -30,28 +32,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnReadyToShow
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_readyToShow == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-ready-to-show" + Id, () =>
|
||||
{
|
||||
_readyToShow();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-ready-to-show", Id);
|
||||
}
|
||||
_readyToShow += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_readyToShow -= value;
|
||||
|
||||
if (_readyToShow == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-ready-to-show" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-ready-to-show", Id, _readyToShow, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-ready-to-show", Id, _readyToShow, value);
|
||||
}
|
||||
|
||||
private event Action _readyToShow;
|
||||
@@ -61,28 +43,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action<string> OnPageTitleUpdated
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_pageTitleUpdated == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-page-title-updated" + Id, (title) =>
|
||||
{
|
||||
_pageTitleUpdated(title.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-page-title-updated", Id);
|
||||
}
|
||||
_pageTitleUpdated += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_pageTitleUpdated -= value;
|
||||
|
||||
if (_pageTitleUpdated == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-page-title-updated" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-page-title-updated", Id, _pageTitleUpdated, value, (args) => args.ToString());
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-page-title-updated", Id, _pageTitleUpdated, value);
|
||||
}
|
||||
|
||||
private event Action<string> _pageTitleUpdated;
|
||||
@@ -92,28 +54,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnClose
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_close == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-close" + Id, () =>
|
||||
{
|
||||
_close();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-close", Id);
|
||||
}
|
||||
_close += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_close -= value;
|
||||
|
||||
if (_close == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-close" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-close", Id, _close, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-close", Id, _close, value);
|
||||
}
|
||||
|
||||
private event Action _close;
|
||||
@@ -125,28 +67,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnClosed
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_closed == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-closed" + Id, () =>
|
||||
{
|
||||
_closed();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-closed", Id);
|
||||
}
|
||||
_closed += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_closed -= value;
|
||||
|
||||
if (_closed == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-closed" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-closed", Id, _closed, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-closed", Id, _closed, value);
|
||||
}
|
||||
|
||||
private event Action _closed;
|
||||
@@ -156,28 +78,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnSessionEnd
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_sessionEnd == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-session-end" + Id, () =>
|
||||
{
|
||||
_sessionEnd();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-session-end", Id);
|
||||
}
|
||||
_sessionEnd += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_sessionEnd -= value;
|
||||
|
||||
if (_sessionEnd == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-session-end" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-session-end", Id, _sessionEnd, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-session-end", Id, _sessionEnd, value);
|
||||
}
|
||||
|
||||
private event Action _sessionEnd;
|
||||
@@ -187,28 +89,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnUnresponsive
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_unresponsive == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-unresponsive" + Id, () =>
|
||||
{
|
||||
_unresponsive();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-unresponsive", Id);
|
||||
}
|
||||
_unresponsive += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_unresponsive -= value;
|
||||
|
||||
if (_unresponsive == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-unresponsive" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-unresponsive", Id, _unresponsive, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-unresponsive", Id, _unresponsive, value);
|
||||
}
|
||||
|
||||
private event Action _unresponsive;
|
||||
@@ -218,28 +100,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnResponsive
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_responsive == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-responsive" + Id, () =>
|
||||
{
|
||||
_responsive();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-responsive", Id);
|
||||
}
|
||||
_responsive += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_responsive -= value;
|
||||
|
||||
if (_responsive == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-responsive" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-responsive", Id, _responsive, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-responsive", Id, _responsive, value);
|
||||
}
|
||||
|
||||
private event Action _responsive;
|
||||
@@ -249,28 +111,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnBlur
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_blur == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-blur" + Id, () =>
|
||||
{
|
||||
_blur();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-blur", Id);
|
||||
}
|
||||
_blur += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_blur -= value;
|
||||
|
||||
if (_blur == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-blur" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-blur", Id, _blur, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-blur", Id, _blur, value);
|
||||
}
|
||||
|
||||
private event Action _blur;
|
||||
@@ -280,28 +122,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnFocus
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_focus == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-focus" + Id, () =>
|
||||
{
|
||||
_focus();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-focus", Id);
|
||||
}
|
||||
_focus += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_focus -= value;
|
||||
|
||||
if (_focus == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-focus" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-focus", Id, _focus, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-focus", Id, _focus, value);
|
||||
}
|
||||
|
||||
private event Action _focus;
|
||||
@@ -311,28 +133,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnShow
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_show == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-show" + Id, () =>
|
||||
{
|
||||
_show();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-show", Id);
|
||||
}
|
||||
_show += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_show -= value;
|
||||
|
||||
if (_show == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-show" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-show", Id, _show, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-show", Id, _show, value);
|
||||
}
|
||||
|
||||
private event Action _show;
|
||||
@@ -342,28 +144,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnHide
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_hide == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-hide" + Id, () =>
|
||||
{
|
||||
_hide();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-hide", Id);
|
||||
}
|
||||
_hide += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_hide -= value;
|
||||
|
||||
if (_hide == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-hide" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-hide", Id, _hide, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-hide", Id, _hide, value);
|
||||
}
|
||||
|
||||
private event Action _hide;
|
||||
@@ -373,28 +155,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnMaximize
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_maximize == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-maximize" + Id, () =>
|
||||
{
|
||||
_maximize();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-maximize", Id);
|
||||
}
|
||||
_maximize += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_maximize -= value;
|
||||
|
||||
if (_maximize == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-maximize" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-maximize", Id, _maximize, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-maximize", Id, _maximize, value);
|
||||
}
|
||||
|
||||
private event Action _maximize;
|
||||
@@ -404,28 +166,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnUnmaximize
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_unmaximize == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-unmaximize" + Id, () =>
|
||||
{
|
||||
_unmaximize();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-unmaximize", Id);
|
||||
}
|
||||
_unmaximize += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_unmaximize -= value;
|
||||
|
||||
if (_unmaximize == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-unmaximize" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-unmaximize", Id, _unmaximize, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-unmaximize", Id, _unmaximize, value);
|
||||
}
|
||||
|
||||
private event Action _unmaximize;
|
||||
@@ -435,28 +177,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnMinimize
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_minimize == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-minimize" + Id, () =>
|
||||
{
|
||||
_minimize();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-minimize", Id);
|
||||
}
|
||||
_minimize += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_minimize -= value;
|
||||
|
||||
if (_minimize == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-minimize" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-minimize", Id, _minimize, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-minimize", Id, _minimize, value);
|
||||
}
|
||||
|
||||
private event Action _minimize;
|
||||
@@ -466,28 +188,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnRestore
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_restore == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-restore" + Id, () =>
|
||||
{
|
||||
_restore();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-restore", Id);
|
||||
}
|
||||
_restore += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_restore -= value;
|
||||
|
||||
if (_restore == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-restore" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-restore", Id, _restore, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-restore", Id, _restore, value);
|
||||
}
|
||||
|
||||
private event Action _restore;
|
||||
@@ -497,28 +199,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnResize
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_resize == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-resize" + Id, () =>
|
||||
{
|
||||
_resize();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-resize", Id);
|
||||
}
|
||||
_resize += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_resize -= value;
|
||||
|
||||
if (_resize == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-resize" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-resize", Id, _resize, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-resize", Id, _resize, value);
|
||||
}
|
||||
|
||||
private event Action _resize;
|
||||
@@ -530,28 +212,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnMove
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_move == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-move" + Id, () =>
|
||||
{
|
||||
_move();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-move", Id);
|
||||
}
|
||||
_move += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_move -= value;
|
||||
|
||||
if (_move == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-move" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-move", Id, _move, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-move", Id, _move, value);
|
||||
}
|
||||
|
||||
private event Action _move;
|
||||
@@ -561,28 +223,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnMoved
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_moved == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-moved" + Id, () =>
|
||||
{
|
||||
_moved();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-moved", Id);
|
||||
}
|
||||
_moved += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_moved -= value;
|
||||
|
||||
if (_moved == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-moved" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-moved", Id, _moved, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-moved", Id, _moved, value);
|
||||
}
|
||||
|
||||
private event Action _moved;
|
||||
@@ -592,28 +234,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnEnterFullScreen
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_enterFullScreen == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-enter-full-screen" + Id, () =>
|
||||
{
|
||||
_enterFullScreen();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-enter-full-screen", Id);
|
||||
}
|
||||
_enterFullScreen += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_enterFullScreen -= value;
|
||||
|
||||
if (_enterFullScreen == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-enter-full-screen" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-enter-full-screen", Id, _enterFullScreen, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-enter-full-screen", Id, _enterFullScreen, value);
|
||||
}
|
||||
|
||||
private event Action _enterFullScreen;
|
||||
@@ -623,28 +245,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnLeaveFullScreen
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_leaveFullScreen == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-leave-full-screen" + Id, () =>
|
||||
{
|
||||
_leaveFullScreen();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-leave-full-screen", Id);
|
||||
}
|
||||
_leaveFullScreen += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_leaveFullScreen -= value;
|
||||
|
||||
if (_leaveFullScreen == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-leave-full-screen" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-leave-full-screen", Id, _leaveFullScreen, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-leave-full-screen", Id, _leaveFullScreen, value);
|
||||
}
|
||||
|
||||
private event Action _leaveFullScreen;
|
||||
@@ -654,28 +256,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnEnterHtmlFullScreen
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_enterHtmlFullScreen == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-enter-html-full-screen" + Id, () =>
|
||||
{
|
||||
_enterHtmlFullScreen();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-enter-html-full-screen", Id);
|
||||
}
|
||||
_enterHtmlFullScreen += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_enterHtmlFullScreen -= value;
|
||||
|
||||
if (_enterHtmlFullScreen == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-enter-html-full-screen" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-enter-html-full-screen", Id, _enterHtmlFullScreen, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-enter-html-full-screen", Id, _enterHtmlFullScreen, value);
|
||||
}
|
||||
|
||||
private event Action _enterHtmlFullScreen;
|
||||
@@ -685,28 +267,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnLeaveHtmlFullScreen
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_leaveHtmlFullScreen == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-leave-html-full-screen" + Id, () =>
|
||||
{
|
||||
_leaveHtmlFullScreen();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-leave-html-full-screen", Id);
|
||||
}
|
||||
_leaveHtmlFullScreen += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_leaveHtmlFullScreen -= value;
|
||||
|
||||
if (_leaveHtmlFullScreen == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-leave-html-full-screen" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-leave-html-full-screen", Id, _leaveHtmlFullScreen, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-leave-html-full-screen", Id, _leaveHtmlFullScreen, value);
|
||||
}
|
||||
|
||||
private event Action _leaveHtmlFullScreen;
|
||||
@@ -722,28 +284,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action<string> OnAppCommand
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_appCommand == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-app-command" + Id, (command) =>
|
||||
{
|
||||
_appCommand(command.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-app-command", Id);
|
||||
}
|
||||
_appCommand += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_appCommand -= value;
|
||||
|
||||
if (_appCommand == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-app-command" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-app-command", Id, _appCommand, value, (args) => args.ToString());
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-app-command", Id, _appCommand, value);
|
||||
}
|
||||
|
||||
private event Action<string> _appCommand;
|
||||
@@ -753,28 +295,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action<string> OnSwipe
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_swipe == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-swipe" + Id, (direction) =>
|
||||
{
|
||||
_swipe(direction.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-swipe", Id);
|
||||
}
|
||||
_swipe += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_swipe -= value;
|
||||
|
||||
if (_swipe == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-swipe" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-swipe", Id, _swipe, value, (args) => args.ToString());
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-swipe", Id, _swipe, value);
|
||||
}
|
||||
|
||||
private event Action<string> _swipe;
|
||||
@@ -784,28 +306,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnSheetBegin
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_sheetBegin == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-sheet-begin" + Id, () =>
|
||||
{
|
||||
_sheetBegin();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-sheet-begin", Id);
|
||||
}
|
||||
_sheetBegin += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_sheetBegin -= value;
|
||||
|
||||
if (_sheetBegin == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-sheet-begin" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-sheet-begin", Id, _sheetBegin, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-sheet-begin", Id, _sheetBegin, value);
|
||||
}
|
||||
|
||||
private event Action _sheetBegin;
|
||||
@@ -815,28 +317,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnSheetEnd
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_sheetEnd == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-sheet-end" + Id, () =>
|
||||
{
|
||||
_sheetEnd();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-sheet-end", Id);
|
||||
}
|
||||
_sheetEnd += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_sheetEnd -= value;
|
||||
|
||||
if (_sheetEnd == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-sheet-end" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-sheet-end", Id, _sheetEnd, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-sheet-end", Id, _sheetEnd, value);
|
||||
}
|
||||
|
||||
private event Action _sheetEnd;
|
||||
@@ -846,28 +328,8 @@ public class BrowserWindow
|
||||
/// </summary>
|
||||
public event Action OnNewWindowForTab
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_newWindowForTab == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("browserWindow-new-window-for-tab" + Id, () =>
|
||||
{
|
||||
_newWindowForTab();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-browserWindow-new-window-for-tab", Id);
|
||||
}
|
||||
_newWindowForTab += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_newWindowForTab -= value;
|
||||
|
||||
if (_newWindowForTab == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("browserWindow-new-window-for-tab" + Id);
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("browserWindow-new-window-for-tab", Id, _newWindowForTab, value);
|
||||
remove => ApiEventManager.RemoveEvent("browserWindow-new-window-for-tab", Id, _newWindowForTab, value);
|
||||
}
|
||||
|
||||
private event Action _newWindowForTab;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.API.Entities;
|
||||
using ElectronNET.API.Extensions;
|
||||
using ElectronNET.Common;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
@@ -183,28 +184,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action Updated
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_updated == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("nativeTheme-updated" + GetHashCode(), () =>
|
||||
{
|
||||
_updated();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-nativeTheme-updated-event", GetHashCode());
|
||||
}
|
||||
_updated += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_updated -= value;
|
||||
|
||||
if (_updated == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("nativeTheme-updated" + GetHashCode());
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("nativeTheme-updated", GetHashCode(), _updated, value);
|
||||
remove => ApiEventManager.RemoveEvent("nativeTheme-updated", GetHashCode(), _updated, value);
|
||||
}
|
||||
|
||||
private event Action _updated;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.Common;
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
@@ -13,26 +15,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnLockScreen
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_lockScreen == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("pm-lock-screen" , () =>
|
||||
{
|
||||
_lockScreen();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-pm-lock-screen");
|
||||
}
|
||||
_lockScreen += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_lockScreen -= value;
|
||||
|
||||
if (_lockScreen == null)
|
||||
BridgeConnector.Socket.Off("pm-lock-screen");
|
||||
}
|
||||
add => ApiEventManager.AddEvent("pm-lock-screen", string.Empty, _lockScreen, value);
|
||||
remove => ApiEventManager.RemoveEvent("pm-lock-screen", string.Empty, _lockScreen, value);
|
||||
}
|
||||
|
||||
private event Action _lockScreen;
|
||||
@@ -42,26 +26,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnUnLockScreen
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_unlockScreen == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("pm-unlock-screen", () =>
|
||||
{
|
||||
_unlockScreen();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-pm-unlock-screen");
|
||||
}
|
||||
_unlockScreen += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_unlockScreen -= value;
|
||||
|
||||
if (_unlockScreen == null)
|
||||
BridgeConnector.Socket.Off("pm-unlock-screen");
|
||||
}
|
||||
add => ApiEventManager.AddEvent("pm-unlock-screen", string.Empty, _unlockScreen, value);
|
||||
remove => ApiEventManager.RemoveEvent("pm-unlock-screen", string.Empty, _unlockScreen, value);
|
||||
}
|
||||
|
||||
private event Action _unlockScreen;
|
||||
@@ -71,26 +37,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnSuspend
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_suspend == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("pm-suspend", () =>
|
||||
{
|
||||
_suspend();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-pm-suspend");
|
||||
}
|
||||
_suspend += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_suspend -= value;
|
||||
|
||||
if (_suspend == null)
|
||||
BridgeConnector.Socket.Off("pm-suspend");
|
||||
}
|
||||
add => ApiEventManager.AddEvent("pm-suspend", string.Empty, _suspend, value);
|
||||
remove => ApiEventManager.RemoveEvent("pm-suspend", string.Empty, _suspend, value);
|
||||
}
|
||||
|
||||
private event Action _suspend;
|
||||
@@ -100,26 +48,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnResume
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_resume == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("pm-resume", () =>
|
||||
{
|
||||
_resume();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-pm-resume");
|
||||
}
|
||||
_resume += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_resume -= value;
|
||||
|
||||
if (_resume == null)
|
||||
BridgeConnector.Socket.Off("pm-resume");
|
||||
}
|
||||
add => ApiEventManager.AddEvent("pm-resume", string.Empty, _resume, value);
|
||||
remove => ApiEventManager.RemoveEvent("pm-resume", string.Empty, _resume, value);
|
||||
}
|
||||
|
||||
private event Action _resume;
|
||||
@@ -129,26 +59,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnAC
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_onAC == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("pm-on-ac", () =>
|
||||
{
|
||||
_onAC();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-pm-on-ac");
|
||||
}
|
||||
_onAC += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_onAC -= value;
|
||||
|
||||
if (_onAC == null)
|
||||
BridgeConnector.Socket.Off("pm-on-ac");
|
||||
}
|
||||
add => ApiEventManager.AddEvent("pm-on-ac", string.Empty, _onAC, value);
|
||||
remove => ApiEventManager.RemoveEvent("pm-on-ac", string.Empty, _onAC, value);
|
||||
}
|
||||
|
||||
private event Action _onAC;
|
||||
@@ -158,31 +70,12 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnBattery
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_onBattery == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("pm-on-battery", () =>
|
||||
{
|
||||
_onBattery();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-pm-on-battery");
|
||||
}
|
||||
_onBattery += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_onBattery -= value;
|
||||
|
||||
if (_onBattery == null)
|
||||
BridgeConnector.Socket.Off("pm-on-battery");
|
||||
}
|
||||
add => ApiEventManager.AddEvent("pm-on-battery", string.Empty, _onBattery, value);
|
||||
remove => ApiEventManager.RemoveEvent("pm-on-battery", string.Empty, _onBattery, value);
|
||||
}
|
||||
|
||||
private event Action _onBattery;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when the system is about to reboot or shut down. If the event handler
|
||||
/// invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
|
||||
@@ -191,26 +84,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnShutdown
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_shutdown == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("pm-shutdown", () =>
|
||||
{
|
||||
_shutdown();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-pm-shutdown");
|
||||
}
|
||||
_shutdown += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_shutdown -= value;
|
||||
|
||||
if (_shutdown == null)
|
||||
BridgeConnector.Socket.Off("pm-on-shutdown");
|
||||
}
|
||||
add => ApiEventManager.AddEvent("pm-shutdown", string.Empty, _shutdown, value);
|
||||
remove => ApiEventManager.RemoveEvent("pm-shutdown", string.Empty, _shutdown, value);
|
||||
}
|
||||
|
||||
private event Action _shutdown;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.Common;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
@@ -17,26 +18,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<Display> OnDisplayAdded
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_onDisplayAdded == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("screen-display-added-event" + GetHashCode(), (display) =>
|
||||
{
|
||||
_onDisplayAdded(((JObject)display).ToObject<Display>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-screen-display-added", GetHashCode());
|
||||
}
|
||||
_onDisplayAdded += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_onDisplayAdded -= value;
|
||||
|
||||
if (_onDisplayAdded == null)
|
||||
BridgeConnector.Socket.Off("screen-display-added-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("screen-display-added", GetHashCode(), _onDisplayAdded, value, (args) => ((JObject)args).ToObject<Display>());
|
||||
remove => ApiEventManager.RemoveEvent("screen-display-added", GetHashCode(), _onDisplayAdded, value);
|
||||
}
|
||||
|
||||
private event Action<Display> _onDisplayAdded;
|
||||
@@ -46,26 +29,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<Display> OnDisplayRemoved
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_onDisplayRemoved == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("screen-display-removed-event" + GetHashCode(), (display) =>
|
||||
{
|
||||
_onDisplayRemoved(((JObject)display).ToObject<Display>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-screen-display-removed", GetHashCode());
|
||||
}
|
||||
_onDisplayRemoved += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_onDisplayRemoved -= value;
|
||||
|
||||
if (_onDisplayRemoved == null)
|
||||
BridgeConnector.Socket.Off("screen-display-removed-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("screen-display-removed", GetHashCode(), _onDisplayRemoved, value, (args) => ((JObject)args).ToObject<Display>());
|
||||
remove => ApiEventManager.RemoveEvent("screen-display-removed", GetHashCode(), _onDisplayRemoved, value);
|
||||
}
|
||||
|
||||
private event Action<Display> _onDisplayRemoved;
|
||||
@@ -77,29 +42,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<Display, string[]> OnDisplayMetricsChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_onDisplayMetricsChanged == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("screen-display-metrics-changed-event" + GetHashCode(), (args) =>
|
||||
{
|
||||
var display = ((JArray)args).First.ToObject<Display>();
|
||||
var metrics = ((JArray)args).Last.ToObject<string[]>();
|
||||
|
||||
_onDisplayMetricsChanged(display, metrics);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-screen-display-metrics-changed", GetHashCode());
|
||||
}
|
||||
_onDisplayMetricsChanged += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_onDisplayMetricsChanged -= value;
|
||||
|
||||
if (_onDisplayMetricsChanged == null)
|
||||
BridgeConnector.Socket.Off("screen-display-metrics-changed-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddScreenEvent("screen-display-metrics-changed", GetHashCode(), _onDisplayMetricsChanged, value);
|
||||
remove => ApiEventManager.RemoveScreenEvent("screen-display-metrics-changed", GetHashCode(), _onDisplayMetricsChanged, value);
|
||||
}
|
||||
|
||||
private event Action<Display, string[]> _onDisplayMetricsChanged;
|
||||
|
||||
@@ -6,6 +6,8 @@ using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.Common;
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
@@ -19,29 +21,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<TrayClickEventArgs, Rectangle> OnClick
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_click == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<dynamic>("tray-click-event" + GetHashCode(), (result) =>
|
||||
{
|
||||
var args = ((JArray)result).ToObject<object[]>();
|
||||
var trayClickEventArgs = ((JObject)args[0]).ToObject<TrayClickEventArgs>();
|
||||
var bounds = ((JObject)args[1]).ToObject<Rectangle>();
|
||||
_click(trayClickEventArgs, bounds);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-tray-click", GetHashCode());
|
||||
}
|
||||
_click += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_click -= value;
|
||||
|
||||
if (_click == null)
|
||||
BridgeConnector.Socket.Off("tray-click-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddTrayEvent("tray-click", GetHashCode(), _click, value);
|
||||
remove => ApiEventManager.RemoveTrayEvent("tray-click", GetHashCode(), _click, value);
|
||||
}
|
||||
|
||||
private event Action<TrayClickEventArgs, Rectangle> _click;
|
||||
@@ -51,29 +32,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<TrayClickEventArgs, Rectangle> OnRightClick
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_rightClick == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<dynamic>("tray-right-click-event" + GetHashCode(), (result) =>
|
||||
{
|
||||
var args = ((JArray)result).ToObject<object[]>();
|
||||
var trayClickEventArgs = ((JObject)args[0]).ToObject<TrayClickEventArgs>();
|
||||
var bounds = ((JObject)args[1]).ToObject<Rectangle>();
|
||||
_rightClick(trayClickEventArgs, bounds);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-tray-right-click", GetHashCode());
|
||||
}
|
||||
_rightClick += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_rightClick -= value;
|
||||
|
||||
if (_rightClick == null)
|
||||
BridgeConnector.Socket.Off("tray-right-click-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddTrayEvent("tray-right-click", GetHashCode(), _rightClick, value);
|
||||
remove => ApiEventManager.RemoveTrayEvent("tray-right-click", GetHashCode(), _rightClick, value);
|
||||
}
|
||||
|
||||
private event Action<TrayClickEventArgs, Rectangle> _rightClick;
|
||||
@@ -83,29 +43,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<TrayClickEventArgs, Rectangle> OnDoubleClick
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_doubleClick == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<dynamic>("tray-double-click-event" + GetHashCode(), (result) =>
|
||||
{
|
||||
var args = ((JArray)result).ToObject<object[]>();
|
||||
var trayClickEventArgs = ((JObject)args[0]).ToObject<TrayClickEventArgs>();
|
||||
var bounds = ((JObject)args[1]).ToObject<Rectangle>();
|
||||
_doubleClick(trayClickEventArgs, bounds);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-tray-double-click", GetHashCode());
|
||||
}
|
||||
_doubleClick += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_doubleClick -= value;
|
||||
|
||||
if (_doubleClick == null)
|
||||
BridgeConnector.Socket.Off("tray-double-click-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddTrayEvent("tray-double-click", GetHashCode(), _doubleClick, value);
|
||||
remove => ApiEventManager.RemoveTrayEvent("tray-double-click", GetHashCode(), _doubleClick, value);
|
||||
}
|
||||
|
||||
private event Action<TrayClickEventArgs, Rectangle> _doubleClick;
|
||||
@@ -115,26 +54,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnBalloonShow
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_balloonShow == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("tray-balloon-show-event" + GetHashCode(), () =>
|
||||
{
|
||||
_balloonShow();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-tray-balloon-show", GetHashCode());
|
||||
}
|
||||
_balloonShow += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_balloonShow -= value;
|
||||
|
||||
if (_balloonShow == null)
|
||||
BridgeConnector.Socket.Off("tray-balloon-show-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("tray-balloon-show", GetHashCode(), _balloonShow, value);
|
||||
remove => ApiEventManager.RemoveEvent("tray-balloon-show", GetHashCode(), _balloonShow, value);
|
||||
}
|
||||
|
||||
private event Action _balloonShow;
|
||||
@@ -144,26 +65,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnBalloonClick
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_balloonClick == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("tray-balloon-click-event" + GetHashCode(), () =>
|
||||
{
|
||||
_balloonClick();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-tray-balloon-click", GetHashCode());
|
||||
}
|
||||
_balloonClick += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_balloonClick -= value;
|
||||
|
||||
if (_balloonClick == null)
|
||||
BridgeConnector.Socket.Off("tray-balloon-click-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("tray-balloon-click", GetHashCode(), _balloonClick, value);
|
||||
remove => ApiEventManager.RemoveEvent("tray-balloon-click", GetHashCode(), _balloonClick, value);
|
||||
}
|
||||
|
||||
private event Action _balloonClick;
|
||||
@@ -174,26 +77,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnBalloonClosed
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_balloonClosed == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("tray-balloon-closed-event" + GetHashCode(), () =>
|
||||
{
|
||||
_balloonClosed();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-tray-balloon-closed", GetHashCode());
|
||||
}
|
||||
_balloonClosed += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_balloonClosed -= value;
|
||||
|
||||
if (_balloonClosed == null)
|
||||
BridgeConnector.Socket.Off("tray-balloon-closed-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("tray-balloon-closed", GetHashCode(), _balloonClosed, value);
|
||||
remove => ApiEventManager.RemoveEvent("tray-balloon-closed", GetHashCode(), _balloonClosed, value);
|
||||
}
|
||||
|
||||
private event Action _balloonClosed;
|
||||
|
||||
@@ -4,6 +4,8 @@ using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.Common;
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace ElectronNET.API;
|
||||
|
||||
@@ -30,26 +32,8 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action<bool> OnCrashed
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_crashed == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-crashed" + Id, (killed) =>
|
||||
{
|
||||
_crashed((bool)killed);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-crashed", Id);
|
||||
}
|
||||
_crashed += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_crashed -= value;
|
||||
|
||||
if (_crashed == null)
|
||||
BridgeConnector.Socket.Off("webContents-crashed" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-crashed", Id, _crashed, value, (args) => (bool)args);
|
||||
remove => ApiEventManager.RemoveEvent("webContents-crashed", Id, _crashed, value);
|
||||
}
|
||||
|
||||
private event Action<bool> _crashed;
|
||||
@@ -60,26 +44,8 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action OnDidFinishLoad
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_didFinishLoad == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-didFinishLoad" + Id, () =>
|
||||
{
|
||||
_didFinishLoad();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-didFinishLoad", Id);
|
||||
}
|
||||
_didFinishLoad += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_didFinishLoad -= value;
|
||||
|
||||
if (_didFinishLoad == null)
|
||||
BridgeConnector.Socket.Off("webContents-didFinishLoad" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-didFinishLoad", Id, _didFinishLoad, value);
|
||||
remove => ApiEventManager.RemoveEvent("webContents-didFinishLoad", Id, _didFinishLoad, value);
|
||||
}
|
||||
|
||||
private event Action _didFinishLoad;
|
||||
@@ -89,26 +55,8 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action<string> OnDidStartNavigation
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_didStartNavigation == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<string>("webContents-didStartNavigation" + Id, (url) =>
|
||||
{
|
||||
_didStartNavigation(url);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-didStartNavigation", Id);
|
||||
}
|
||||
_didStartNavigation += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_didStartNavigation -= value;
|
||||
|
||||
if (_didStartNavigation == null)
|
||||
BridgeConnector.Socket.Off("webContents-didStartNavigation" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-didStartNavigation", Id, _didStartNavigation, value);
|
||||
remove => ApiEventManager.RemoveEvent("webContents-didStartNavigation", Id, _didStartNavigation, value);
|
||||
}
|
||||
|
||||
private event Action<string> _didStartNavigation;
|
||||
@@ -119,26 +67,8 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action<OnDidNavigateInfo> OnDidNavigate
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_didNavigate == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<OnDidNavigateInfo>("webContents-didNavigate" + Id, (data) =>
|
||||
{
|
||||
_didNavigate(data);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-didNavigate", Id);
|
||||
}
|
||||
_didNavigate += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_didNavigate -= value;
|
||||
|
||||
if (_didNavigate == null)
|
||||
BridgeConnector.Socket.Off("webContents-didNavigate" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-didNavigate", Id, _didNavigate, value);
|
||||
remove => ApiEventManager.RemoveEvent("webContents-didNavigate", Id, _didNavigate, value);
|
||||
}
|
||||
|
||||
private event Action<OnDidNavigateInfo> _didNavigate;
|
||||
@@ -149,26 +79,8 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action<string> OnWillRedirect
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_willRedirect == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<string>("webContents-willRedirect" + Id, (url) =>
|
||||
{
|
||||
_willRedirect(url);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-willRedirect", Id);
|
||||
}
|
||||
_willRedirect += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_willRedirect -= value;
|
||||
|
||||
if (_willRedirect == null)
|
||||
BridgeConnector.Socket.Off("webContents-willRedirect" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-willRedirect", Id, _willRedirect, value);
|
||||
remove => ApiEventManager.RemoveEvent("webContents-willRedirect", Id, _willRedirect, value);
|
||||
}
|
||||
|
||||
private event Action<string> _willRedirect;
|
||||
@@ -178,56 +90,19 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action<string> OnDidRedirectNavigation
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_didRedirectNavigation == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-didRedirectNavigation" + Id, (url) =>
|
||||
{
|
||||
_didRedirectNavigation(url?.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-didRedirectNavigation", Id);
|
||||
}
|
||||
_didRedirectNavigation += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_didRedirectNavigation -= value;
|
||||
|
||||
if (_didRedirectNavigation == null)
|
||||
BridgeConnector.Socket.Off("webContents-didRedirectNavigation" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-didRedirectNavigation", Id, _didRedirectNavigation, value);
|
||||
remove => ApiEventManager.RemoveEvent("webContents-didRedirectNavigation", Id, _didRedirectNavigation, value);
|
||||
}
|
||||
|
||||
private event Action<string> _didRedirectNavigation;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This event is like OnDidFinishLoad but emitted when the load failed.
|
||||
/// </summary>
|
||||
public event Action<OnDidFailLoadInfo> OnDidFailLoad
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_didFailLoad == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-willRedirect" + Id, (data) =>
|
||||
{
|
||||
_didFailLoad(((JObject) data).ToObject<OnDidFailLoadInfo>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-willRedirect", Id);
|
||||
}
|
||||
_didFailLoad += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_didFailLoad -= value;
|
||||
|
||||
if (_didFailLoad == null)
|
||||
BridgeConnector.Socket.Off("webContents-willRedirect" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-didFailLoad", Id, _didFailLoad, value, (args) => ((JObject)args).ToObject<OnDidFailLoadInfo>());
|
||||
remove => ApiEventManager.RemoveEvent("webContents-didFailLoad", Id, _didFailLoad, value);
|
||||
}
|
||||
|
||||
private event Action<OnDidFailLoadInfo> _didFailLoad;
|
||||
@@ -237,27 +112,8 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action<InputEvent> InputEvent
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_inputEvent == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-input-event" + Id, (eventArgs) =>
|
||||
{
|
||||
var inputEvent = ((JObject)eventArgs).ToObject<InputEvent>();
|
||||
_inputEvent(inputEvent);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-input-event", Id);
|
||||
}
|
||||
_inputEvent += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_inputEvent -= value;
|
||||
|
||||
if (_inputEvent == null)
|
||||
BridgeConnector.Socket.Off("webContents-input-event" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-input-event", Id, _inputEvent, value, (args) => ((JObject)args).ToObject<InputEvent>());
|
||||
remove => ApiEventManager.RemoveEvent("webContents-input-event", Id, _inputEvent, value);
|
||||
}
|
||||
|
||||
private event Action<InputEvent> _inputEvent;
|
||||
@@ -267,26 +123,8 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action OnDomReady
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_domReady == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-domReady" + Id, () =>
|
||||
{
|
||||
_domReady();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-domReady", Id);
|
||||
}
|
||||
_domReady += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_domReady -= value;
|
||||
|
||||
if (_domReady == null)
|
||||
BridgeConnector.Socket.Off("webContents-domReady" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-domReady", Id, _domReady, value);
|
||||
remove => ApiEventManager.RemoveEvent("webContents-domReady", Id, _domReady, value);
|
||||
}
|
||||
|
||||
private event Action _domReady;
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace ElectronNET.API
|
||||
get => _isQuitOnWindowAllClosed;
|
||||
set
|
||||
{
|
||||
BridgeConnector.Socket.Emit("quit-app-window-all-closed-event", value);
|
||||
BridgeConnector.Socket.Emit("quit-app-window-all-closed", value);
|
||||
_isQuitOnWindowAllClosed = value;
|
||||
}
|
||||
}
|
||||
|
||||
99
src/ElectronNET.API/Common/ApiEventManager.cs
Normal file
99
src/ElectronNET.API/Common/ApiEventManager.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using ElectronNET.API;
|
||||
using ElectronNET.API.Entities;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace ElectronNET.Common;
|
||||
|
||||
internal static class ApiEventManager
|
||||
{
|
||||
internal static void AddEvent(string eventName, object id, Action callback, Action value, string suffix = "")
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
BridgeConnector.Socket.On(eventName + id, () => { callback(); });
|
||||
BridgeConnector.Socket.Emit($"register-{eventName}{suffix}", id);
|
||||
}
|
||||
callback += value;
|
||||
}
|
||||
|
||||
internal static void RemoveEvent(string eventName, object id, Action callback, Action value)
|
||||
{
|
||||
callback -= value;
|
||||
if (callback == null) BridgeConnector.Socket.Off(eventName + id);
|
||||
}
|
||||
|
||||
internal static void AddEvent<T>(string eventName, object id, Action<T> callback, Action<T> value, Func<object, T> converter, string suffix = "")
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
BridgeConnector.Socket.On(eventName + id, (args) =>
|
||||
{
|
||||
var converted = converter.Invoke(args);
|
||||
callback(converted);
|
||||
});
|
||||
BridgeConnector.Socket.Emit($"register-{eventName}{suffix}", id);
|
||||
}
|
||||
callback += value;
|
||||
}
|
||||
|
||||
internal static void AddEvent<T>(string eventName, object id, Action<T> callback, Action<T> value)
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<T>(eventName + id, (args) => callback(args));
|
||||
BridgeConnector.Socket.Emit($"register-{eventName}", id);
|
||||
}
|
||||
callback += value;
|
||||
}
|
||||
|
||||
internal static void RemoveEvent<T>(string eventName, object id, Action<T> callback, Action<T> value)
|
||||
{
|
||||
callback -= value;
|
||||
if (callback == null) BridgeConnector.Socket.Off(eventName + id);
|
||||
}
|
||||
|
||||
internal static void AddTrayEvent(string eventName, object id, Action<TrayClickEventArgs, Rectangle> callback, Action<TrayClickEventArgs, Rectangle> value)
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<dynamic>(eventName + id, (result) =>
|
||||
{
|
||||
var args = ((JArray)result).ToObject<object[]>();
|
||||
var trayClickEventArgs = ((JObject)args[0]).ToObject<TrayClickEventArgs>();
|
||||
var bounds = ((JObject)args[1]).ToObject<Rectangle>();
|
||||
callback(trayClickEventArgs, bounds);
|
||||
});
|
||||
BridgeConnector.Socket.Emit($"register-{eventName}", id);
|
||||
callback += value;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void RemoveTrayEvent(string eventName, object id, Action<TrayClickEventArgs, Rectangle> callback, Action<TrayClickEventArgs, Rectangle> value)
|
||||
{
|
||||
callback -= value;
|
||||
if (callback == null) BridgeConnector.Socket.Off(eventName + id);
|
||||
}
|
||||
|
||||
internal static void AddScreenEvent(string eventName, object id, Action<Display, string[]> callback, Action<Display, string[]> value)
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
BridgeConnector.Socket.On(eventName + id, (args) =>
|
||||
{
|
||||
var display = ((JArray)args).First.ToObject<Display>();
|
||||
var metrics = ((JArray)args).Last.ToObject<string[]>();
|
||||
callback(display, metrics);
|
||||
});
|
||||
BridgeConnector.Socket.Emit($"register-{eventName}", id);
|
||||
callback += value;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void RemoveScreenEvent(string eventName, object id, Action<Display, string[]> callback, Action<Display, string[]> value)
|
||||
{
|
||||
callback -= value;
|
||||
if (callback == null) BridgeConnector.Socket.Off(eventName + id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,45 +18,45 @@ module.exports = (socket, app) => {
|
||||
electronSocket.emit('app-window-all-closed' + appWindowAllClosedEventId);
|
||||
}
|
||||
});
|
||||
socket.on('quit-app-window-all-closed-event', (quit) => {
|
||||
socket.on('quit-app-window-all-closed', (quit) => {
|
||||
isQuitWindowAllClosed = quit;
|
||||
});
|
||||
socket.on('register-app-window-all-closed-event', (id) => {
|
||||
socket.on('register-app-window-all-closed', (id) => {
|
||||
appWindowAllClosedEventId = id;
|
||||
});
|
||||
socket.on('register-app-before-quit-event', (id) => {
|
||||
socket.on('register-app-before-quit', (id) => {
|
||||
app.on('before-quit', (event) => {
|
||||
event.preventDefault();
|
||||
electronSocket.emit('app-before-quit' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-will-quit-event', (id) => {
|
||||
socket.on('register-app-will-quit', (id) => {
|
||||
app.on('will-quit', (event) => {
|
||||
event.preventDefault();
|
||||
electronSocket.emit('app-will-quit' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-browser-window-blur-event', (id) => {
|
||||
socket.on('register-app-browser-window-blur', (id) => {
|
||||
app.on('browser-window-blur', () => {
|
||||
electronSocket.emit('app-browser-window-blur' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-browser-window-focus-event', (id) => {
|
||||
socket.on('register-app-browser-window-focus', (id) => {
|
||||
app.on('browser-window-focus', () => {
|
||||
electronSocket.emit('app-browser-window-focus' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-browser-window-created-event', (id) => {
|
||||
socket.on('register-app-browser-window-created', (id) => {
|
||||
app.on('browser-window-created', () => {
|
||||
electronSocket.emit('app-browser-window-created' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-web-contents-created-event', (id) => {
|
||||
socket.on('register-app-web-contents-created', (id) => {
|
||||
app.on('web-contents-created', () => {
|
||||
electronSocket.emit('app-web-contents-created' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-accessibility-support-changed-event', (id) => {
|
||||
socket.on('register-app-accessibility-support-changed', (id) => {
|
||||
app.on('accessibility-support-changed', (event, accessibilitySupportEnabled) => {
|
||||
electronSocket.emit('app-accessibility-support-changed' + id, accessibilitySupportEnabled);
|
||||
});
|
||||
|
||||
@@ -21,15 +21,15 @@ export = (socket: Socket, app: Electron.App) => {
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('quit-app-window-all-closed-event', (quit) => {
|
||||
socket.on('quit-app-window-all-closed', (quit) => {
|
||||
isQuitWindowAllClosed = quit;
|
||||
});
|
||||
|
||||
socket.on('register-app-window-all-closed-event', (id) => {
|
||||
socket.on('register-app-window-all-closed', (id) => {
|
||||
appWindowAllClosedEventId = id;
|
||||
});
|
||||
|
||||
socket.on('register-app-before-quit-event', (id) => {
|
||||
socket.on('register-app-before-quit', (id) => {
|
||||
app.on('before-quit', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -37,7 +37,7 @@ export = (socket: Socket, app: Electron.App) => {
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-will-quit-event', (id) => {
|
||||
socket.on('register-app-will-quit', (id) => {
|
||||
app.on('will-quit', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -45,31 +45,31 @@ export = (socket: Socket, app: Electron.App) => {
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-browser-window-blur-event', (id) => {
|
||||
socket.on('register-app-browser-window-blur', (id) => {
|
||||
app.on('browser-window-blur', () => {
|
||||
electronSocket.emit('app-browser-window-blur' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-browser-window-focus-event', (id) => {
|
||||
socket.on('register-app-browser-window-focus', (id) => {
|
||||
app.on('browser-window-focus', () => {
|
||||
electronSocket.emit('app-browser-window-focus' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-browser-window-created-event', (id) => {
|
||||
socket.on('register-app-browser-window-created', (id) => {
|
||||
app.on('browser-window-created', () => {
|
||||
electronSocket.emit('app-browser-window-created' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-web-contents-created-event', (id) => {
|
||||
socket.on('register-app-web-contents-created', (id) => {
|
||||
app.on('web-contents-created', () => {
|
||||
electronSocket.emit('app-web-contents-created' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-accessibility-support-changed-event', (id) => {
|
||||
socket.on('register-app-accessibility-support-changed', (id) => {
|
||||
app.on('accessibility-support-changed', (event, accessibilitySupportEnabled) => {
|
||||
electronSocket.emit('app-accessibility-support-changed' + id, accessibilitySupportEnabled);
|
||||
});
|
||||
|
||||
@@ -3,32 +3,32 @@ const electron_updater_1 = require("electron-updater");
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-autoUpdater-error-event', (id) => {
|
||||
socket.on('register-autoUpdater-error', (id) => {
|
||||
electron_updater_1.autoUpdater.on('error', (error) => {
|
||||
electronSocket.emit('autoUpdater-error' + id, error.message);
|
||||
});
|
||||
});
|
||||
socket.on('register-autoUpdater-checking-for-update-event', (id) => {
|
||||
socket.on('register-autoUpdater-checking-for-update', (id) => {
|
||||
electron_updater_1.autoUpdater.on('checking-for-update', () => {
|
||||
electronSocket.emit('autoUpdater-checking-for-update' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-autoUpdater-update-available-event', (id) => {
|
||||
socket.on('register-autoUpdater-update-available', (id) => {
|
||||
electron_updater_1.autoUpdater.on('update-available', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-available' + id, updateInfo);
|
||||
});
|
||||
});
|
||||
socket.on('register-autoUpdater-update-not-available-event', (id) => {
|
||||
socket.on('register-autoUpdater-update-not-available', (id) => {
|
||||
electron_updater_1.autoUpdater.on('update-not-available', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-not-available' + id, updateInfo);
|
||||
});
|
||||
});
|
||||
socket.on('register-autoUpdater-download-progress-event', (id) => {
|
||||
socket.on('register-autoUpdater-download-progress', (id) => {
|
||||
electron_updater_1.autoUpdater.on('download-progress', (progressInfo) => {
|
||||
electronSocket.emit('autoUpdater-download-progress' + id, progressInfo);
|
||||
});
|
||||
});
|
||||
socket.on('register-autoUpdater-update-downloaded-event', (id) => {
|
||||
socket.on('register-autoUpdater-update-downloaded', (id) => {
|
||||
electron_updater_1.autoUpdater.on('update-downloaded', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-downloaded' + id, updateInfo);
|
||||
});
|
||||
|
||||
@@ -5,37 +5,37 @@ let electronSocket;
|
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
|
||||
socket.on('register-autoUpdater-error-event', (id) => {
|
||||
socket.on('register-autoUpdater-error', (id) => {
|
||||
autoUpdater.on('error', (error) => {
|
||||
electronSocket.emit('autoUpdater-error' + id, error.message);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-autoUpdater-checking-for-update-event', (id) => {
|
||||
socket.on('register-autoUpdater-checking-for-update', (id) => {
|
||||
autoUpdater.on('checking-for-update', () => {
|
||||
electronSocket.emit('autoUpdater-checking-for-update' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-autoUpdater-update-available-event', (id) => {
|
||||
socket.on('register-autoUpdater-update-available', (id) => {
|
||||
autoUpdater.on('update-available', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-available' + id, updateInfo);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-autoUpdater-update-not-available-event', (id) => {
|
||||
socket.on('register-autoUpdater-update-not-available', (id) => {
|
||||
autoUpdater.on('update-not-available', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-not-available' + id, updateInfo);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-autoUpdater-download-progress-event', (id) => {
|
||||
socket.on('register-autoUpdater-download-progress', (id) => {
|
||||
autoUpdater.on('download-progress', (progressInfo) => {
|
||||
electronSocket.emit('autoUpdater-download-progress' + id, progressInfo);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-autoUpdater-update-downloaded-event', (id) => {
|
||||
socket.on('register-autoUpdater-update-downloaded', (id) => {
|
||||
autoUpdater.on('update-downloaded', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-downloaded' + id, updateInfo);
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ module.exports = (socket) => {
|
||||
socket.on('nativeTheme-themeSource', (themeSource) => {
|
||||
electron_1.nativeTheme.themeSource = themeSource;
|
||||
});
|
||||
socket.on('register-nativeTheme-updated-event', (id) => {
|
||||
socket.on('register-nativeTheme-updated', (id) => {
|
||||
electron_1.nativeTheme.on('updated', () => {
|
||||
electronSocket.emit('nativeTheme-updated' + id);
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ export = (socket: Socket) => {
|
||||
nativeTheme.themeSource = themeSource;
|
||||
});
|
||||
|
||||
socket.on('register-nativeTheme-updated-event', (id) => {
|
||||
socket.on('register-nativeTheme-updated', (id) => {
|
||||
nativeTheme.on('updated', () => {
|
||||
electronSocket.emit('nativeTheme-updated' + id);
|
||||
});
|
||||
|
||||
@@ -5,17 +5,17 @@ module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-screen-display-added', (id) => {
|
||||
electron_1.screen.on('display-added', (event, display) => {
|
||||
electronSocket.emit('screen-display-added-event' + id, display);
|
||||
electronSocket.emit('screen-display-added' + id, display);
|
||||
});
|
||||
});
|
||||
socket.on('register-screen-display-removed', (id) => {
|
||||
electron_1.screen.on('display-removed', (event, display) => {
|
||||
electronSocket.emit('screen-display-removed-event' + id, display);
|
||||
electronSocket.emit('screen-display-removed' + id, display);
|
||||
});
|
||||
});
|
||||
socket.on('register-screen-display-metrics-changed', (id) => {
|
||||
electron_1.screen.on('display-metrics-changed', (event, display, changedMetrics) => {
|
||||
electronSocket.emit('screen-display-metrics-changed-event' + id, [display, changedMetrics]);
|
||||
electronSocket.emit('screen-display-metrics-changed' + id, [display, changedMetrics]);
|
||||
});
|
||||
});
|
||||
socket.on('screen-getCursorScreenPoint', () => {
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"screen.js","sourceRoot":"","sources":["screen.ts"],"names":[],"mappings":";AACA,uCAAkC;AAClC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,+BAA+B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC9C,iBAAM,CAAC,EAAE,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC1C,cAAc,CAAC,IAAI,CAAC,4BAA4B,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iCAAiC,EAAE,CAAC,EAAE,EAAE,EAAE;QAChD,iBAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC5C,cAAc,CAAC,IAAI,CAAC,8BAA8B,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yCAAyC,EAAE,CAAC,EAAE,EAAE,EAAE;QACxD,iBAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE;YACpE,cAAc,CAAC,IAAI,CAAC,sCAAsC,GAAG,EAAE,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;QAChG,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QAC1C,MAAM,KAAK,GAAG,iBAAM,CAAC,oBAAoB,EAAE,CAAC;QAC5C,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACtC,MAAM,MAAM,GAAG,iBAAM,CAAC,iBAAiB,EAAE,CAAC,QAAQ,CAAC;QACnD,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACvC,MAAM,OAAO,GAAG,iBAAM,CAAC,iBAAiB,EAAE,CAAC;QAC3C,cAAc,CAAC,IAAI,CAAC,mCAAmC,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QACpC,MAAM,OAAO,GAAG,iBAAM,CAAC,cAAc,EAAE,CAAC;QACxC,cAAc,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,+BAA+B,EAAE,CAAC,KAAK,EAAE,EAAE;QACjD,MAAM,OAAO,GAAG,iBAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACrD,cAAc,CAAC,IAAI,CAAC,wCAAwC,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAC,SAAS,EAAE,EAAE;QACjD,MAAM,OAAO,GAAG,iBAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACrD,cAAc,CAAC,IAAI,CAAC,oCAAoC,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
{"version":3,"file":"screen.js","sourceRoot":"","sources":["screen.ts"],"names":[],"mappings":";AACA,uCAAkC;AAClC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,+BAA+B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC9C,iBAAM,CAAC,EAAE,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC1C,cAAc,CAAC,IAAI,CAAC,sBAAsB,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iCAAiC,EAAE,CAAC,EAAE,EAAE,EAAE;QAChD,iBAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC5C,cAAc,CAAC,IAAI,CAAC,wBAAwB,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yCAAyC,EAAE,CAAC,EAAE,EAAE,EAAE;QACxD,iBAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE;YACpE,cAAc,CAAC,IAAI,CAAC,gCAAgC,GAAG,EAAE,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;QAC1F,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QAC1C,MAAM,KAAK,GAAG,iBAAM,CAAC,oBAAoB,EAAE,CAAC;QAC5C,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACtC,MAAM,MAAM,GAAG,iBAAM,CAAC,iBAAiB,EAAE,CAAC,QAAQ,CAAC;QACnD,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACvC,MAAM,OAAO,GAAG,iBAAM,CAAC,iBAAiB,EAAE,CAAC;QAC3C,cAAc,CAAC,IAAI,CAAC,mCAAmC,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QACpC,MAAM,OAAO,GAAG,iBAAM,CAAC,cAAc,EAAE,CAAC;QACxC,cAAc,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,+BAA+B,EAAE,CAAC,KAAK,EAAE,EAAE;QACjD,MAAM,OAAO,GAAG,iBAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACrD,cAAc,CAAC,IAAI,CAAC,wCAAwC,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAC,SAAS,EAAE,EAAE;QACjD,MAAM,OAAO,GAAG,iBAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACrD,cAAc,CAAC,IAAI,CAAC,oCAAoC,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -7,19 +7,19 @@ export = (socket: Socket) => {
|
||||
|
||||
socket.on('register-screen-display-added', (id) => {
|
||||
screen.on('display-added', (event, display) => {
|
||||
electronSocket.emit('screen-display-added-event' + id, display);
|
||||
electronSocket.emit('screen-display-added' + id, display);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-screen-display-removed', (id) => {
|
||||
screen.on('display-removed', (event, display) => {
|
||||
electronSocket.emit('screen-display-removed-event' + id, display);
|
||||
electronSocket.emit('screen-display-removed' + id, display);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-screen-display-metrics-changed', (id) => {
|
||||
screen.on('display-metrics-changed', (event, display, changedMetrics) => {
|
||||
electronSocket.emit('screen-display-metrics-changed-event' + id, [display, changedMetrics]);
|
||||
electronSocket.emit('screen-display-metrics-changed' + id, [display, changedMetrics]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -7,42 +7,42 @@ module.exports = (socket) => {
|
||||
socket.on('register-tray-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('click', (event, bounds) => {
|
||||
electronSocket.emit('tray-click-event' + id, [event.__proto__, bounds]);
|
||||
electronSocket.emit('tray-click' + id, [event.__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-right-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('right-click', (event, bounds) => {
|
||||
electronSocket.emit('tray-right-click-event' + id, [event.__proto__, bounds]);
|
||||
electronSocket.emit('tray-right-click' + id, [event.__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-double-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('double-click', (event, bounds) => {
|
||||
electronSocket.emit('tray-double-click-event' + id, [event.__proto__, bounds]);
|
||||
electronSocket.emit('tray-double-click' + id, [event.__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-balloon-show', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-show', () => {
|
||||
electronSocket.emit('tray-balloon-show-event' + id);
|
||||
electronSocket.emit('tray-balloon-show' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-balloon-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-click', () => {
|
||||
electronSocket.emit('tray-balloon-click-event' + id);
|
||||
electronSocket.emit('tray-balloon-click' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-balloon-closed', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-closed', () => {
|
||||
electronSocket.emit('tray-balloon-closed-event' + id);
|
||||
electronSocket.emit('tray-balloon-closed' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -8,7 +8,7 @@ export = (socket: Socket) => {
|
||||
socket.on('register-tray-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('click', (event, bounds) => {
|
||||
electronSocket.emit('tray-click-event' + id, [(<any>event).__proto__, bounds]);
|
||||
electronSocket.emit('tray-click' + id, [(<any>event).__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -16,7 +16,7 @@ export = (socket: Socket) => {
|
||||
socket.on('register-tray-right-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('right-click', (event, bounds) => {
|
||||
electronSocket.emit('tray-right-click-event' + id, [(<any>event).__proto__, bounds]);
|
||||
electronSocket.emit('tray-right-click' + id, [(<any>event).__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -24,7 +24,7 @@ export = (socket: Socket) => {
|
||||
socket.on('register-tray-double-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('double-click', (event, bounds) => {
|
||||
electronSocket.emit('tray-double-click-event' + id, [(<any>event).__proto__, bounds]);
|
||||
electronSocket.emit('tray-double-click' + id, [(<any>event).__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -32,7 +32,7 @@ export = (socket: Socket) => {
|
||||
socket.on('register-tray-balloon-show', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-show', () => {
|
||||
electronSocket.emit('tray-balloon-show-event' + id);
|
||||
electronSocket.emit('tray-balloon-show' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -40,7 +40,7 @@ export = (socket: Socket) => {
|
||||
socket.on('register-tray-balloon-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-click', () => {
|
||||
electronSocket.emit('tray-balloon-click-event' + id);
|
||||
electronSocket.emit('tray-balloon-click' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -48,7 +48,7 @@ export = (socket: Socket) => {
|
||||
socket.on('register-tray-balloon-closed', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-closed', () => {
|
||||
electronSocket.emit('tray-balloon-closed-event' + id);
|
||||
electronSocket.emit('tray-balloon-closed' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -328,7 +328,7 @@ function startSocketApiBridge(port) {
|
||||
if (nativeTheme === undefined) nativeTheme = require('./api/nativeTheme')(socket);
|
||||
if (dock === undefined) dock = require('./api/dock')(socket);
|
||||
|
||||
socket.on('register-app-open-file-event', (id) => {
|
||||
socket.on('register-app-open-file', (id) => {
|
||||
global['electronsocket'] = socket;
|
||||
|
||||
app.on('open-file', (event, file) => {
|
||||
@@ -342,7 +342,7 @@ function startSocketApiBridge(port) {
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-app-open-url-event', (id) => {
|
||||
socket.on('register-app-open-url', (id) => {
|
||||
global['electronsocket'] = socket;
|
||||
|
||||
app.on('open-url', (event, url) => {
|
||||
|
||||
Reference in New Issue
Block a user