diff --git a/src/ElectronNET.API/API/App.cs b/src/ElectronNET.API/API/App.cs
index acf8723..a7233b0 100644
--- a/src/ElectronNET.API/API/App.cs
+++ b/src/ElectronNET.API/API/App.cs
@@ -45,13 +45,14 @@ namespace ElectronNET.API
BridgeConnector.Socket.Emit("register-app-window-all-closed", GetHashCode());
}
+
_windowAllClosed += value;
}
remove
{
_windowAllClosed -= value;
- if(_windowAllClosed == null)
+ if (_windowAllClosed == null)
BridgeConnector.Socket.Off("app-window-all-closed" + GetHashCode());
}
}
@@ -117,6 +118,7 @@ namespace ElectronNET.API
BridgeConnector.Socket.Emit("register-app-before-quit", GetHashCode());
}
+
_beforeQuit += value;
}
remove
@@ -168,6 +170,7 @@ namespace ElectronNET.API
BridgeConnector.Socket.Emit("register-app-will-quit", GetHashCode());
}
+
_willQuit += value;
}
remove
@@ -194,7 +197,7 @@ namespace ElectronNET.API
{
BridgeConnector.Socket.On("app-will-quit" + GetHashCode() + "quitting", async () =>
{
- if(_willQuit == null)
+ if (_willQuit == null)
{
await this._quitting().ConfigureAwait(false);
Exit();
@@ -203,6 +206,7 @@ namespace ElectronNET.API
BridgeConnector.Socket.Emit("register-app-will-quit", GetHashCode() + "quitting");
}
+
_quitting += value;
}
remove
@@ -276,11 +280,11 @@ namespace ElectronNET.API
///
/// Emitted when the application has finished basic startup.
///
- public event Action Ready
+ public event Action Ready
{
add
{
- if(IsReady)
+ if (IsReady)
{
value();
}
@@ -298,19 +302,23 @@ namespace ElectronNET.API
///
/// Application host fully started.
///
- public bool IsReady
- {
- get { return _isReady; }
+ public bool IsReady
+ {
+ get
+ {
+ return _isReady;
+ }
internal set
{
_isReady = value;
- if(value)
+ if (value)
{
_ready?.Invoke();
}
}
}
+
private bool _isReady = false;
///
@@ -379,7 +387,7 @@ namespace ElectronNET.API
}
- internal App()
+ internal App()
{
CommandLine = new CommandLine();
}
@@ -392,7 +400,7 @@ namespace ElectronNET.API
{
lock (_syncRoot)
{
- if(_app == null)
+ if (_app == null)
{
_app = new App();
}
@@ -541,7 +549,7 @@ namespace ElectronNET.API
cancellationToken.ThrowIfCancellationRequested();
var taskCompletionSource = new TaskCompletionSource();
- using(cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
+ using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
{
BridgeConnector.Socket.On("appGetPathCompleted", (path) =>
{
@@ -554,7 +562,7 @@ namespace ElectronNET.API
return await taskCompletionSource.Task
.ConfigureAwait(false);
- }
+ }
}
///
@@ -715,7 +723,7 @@ namespace ElectronNET.API
BridgeConnector.Socket.On("appSetAsDefaultProtocolClientCompleted", (success) =>
{
BridgeConnector.Socket.Off("appSetAsDefaultProtocolClientCompleted");
- taskCompletionSource.SetResult((bool) success);
+ taskCompletionSource.SetResult((bool)success);
});
BridgeConnector.Socket.Emit("appSetAsDefaultProtocolClient", protocol, path, args);
@@ -760,7 +768,7 @@ namespace ElectronNET.API
/// The cancellation token.
/// Whether the call succeeded.
public async Task RemoveAsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default)
- {
+ {
cancellationToken.ThrowIfCancellationRequested();
var taskCompletionSource = new TaskCompletionSource();
@@ -769,7 +777,7 @@ namespace ElectronNET.API
BridgeConnector.Socket.On("appRemoveAsDefaultProtocolClientCompleted", (success) =>
{
BridgeConnector.Socket.Off("appRemoveAsDefaultProtocolClientCompleted");
- taskCompletionSource.SetResult((bool) success);
+ taskCompletionSource.SetResult((bool)success);
});
BridgeConnector.Socket.Emit("appRemoveAsDefaultProtocolClient", protocol, path, args);
@@ -841,7 +849,7 @@ namespace ElectronNET.API
BridgeConnector.Socket.On("appIsDefaultProtocolClientCompleted", (success) =>
{
BridgeConnector.Socket.Off("appIsDefaultProtocolClientCompleted");
- taskCompletionSource.SetResult((bool) success);
+ taskCompletionSource.SetResult((bool)success);
});
BridgeConnector.Socket.Emit("appIsDefaultProtocolClient", protocol, path, args);
@@ -869,7 +877,7 @@ namespace ElectronNET.API
BridgeConnector.Socket.On("appSetUserTasksCompleted", (success) =>
{
BridgeConnector.Socket.Off("appSetUserTasksCompleted");
- taskCompletionSource.SetResult((bool) success);
+ taskCompletionSource.SetResult((bool)success);
});
BridgeConnector.Socket.Emit("appSetUserTasks", JArray.FromObject(userTasks, _jsonSerializer));
@@ -1066,7 +1074,7 @@ namespace ElectronNET.API
BridgeConnector.Socket.On("appImportCertificateCompleted", (result) =>
{
BridgeConnector.Socket.Off("appImportCertificateCompleted");
- taskCompletionSource.SetResult((int) result);
+ taskCompletionSource.SetResult((int)result);
});
BridgeConnector.Socket.Emit("appImportCertificate", JObject.FromObject(options, _jsonSerializer));
@@ -1122,7 +1130,7 @@ namespace ElectronNET.API
BridgeConnector.Socket.On("appSetBadgeCountCompleted", (success) =>
{
BridgeConnector.Socket.Off("appSetBadgeCountCompleted");
- taskCompletionSource.SetResult((bool) success);
+ taskCompletionSource.SetResult((bool)success);
});
BridgeConnector.Socket.Emit("appSetBadgeCount", count);
@@ -1183,7 +1191,7 @@ namespace ElectronNET.API
{
BridgeConnector.Socket.Off("appGetLoginItemSettingsCompleted");
- var result = ((JObject) loginItemSettings).ToObject();
+ var result = ((JObject)loginItemSettings).ToObject();
taskCompletionSource.SetResult(result);
});
@@ -1310,6 +1318,7 @@ namespace ElectronNET.API
private bool _preventQuit = false;
private const string ModuleName = "app";
+
///
/// Subscribe to an unmapped event on the module.
///
@@ -1317,6 +1326,7 @@ namespace ElectronNET.API
/// The handler
public void On(string eventName, Action action)
=> Events.Instance.On(ModuleName, eventName, action);
+
///
/// Subscribe to an unmapped event on the module.
///
@@ -1324,6 +1334,7 @@ namespace ElectronNET.API
/// The handler
public async Task On(string eventName, Action
public event Action OnUnresponsive
{
- add => ApiEventManager.AddEvent("browserWindow-unresponsive", Id, _unresponsive, value);
- remove => ApiEventManager.RemoveEvent("browserWindow-unresponsive", Id, _unresponsive, value);
+ add => ApiEventManager.AddEvent("browserWindow-unresponsive", Id, _unresponsive, value);
+ remove => ApiEventManager.RemoveEvent("browserWindow-unresponsive", Id, _unresponsive, value);
}
private event Action _unresponsive;
@@ -752,6 +753,7 @@ public class BrowserWindow : ApiBase
{
x = x - 7;
}
+
this.CallMethod2(x, y);
}
@@ -769,6 +771,7 @@ public class BrowserWindow : ApiBase
{
x = x - 7;
}
+
this.CallMethod3(x, y, animate);
}
@@ -906,7 +909,14 @@ public class BrowserWindow : ApiBase
///
/// The menu items.
///
- public IReadOnlyCollection
public bool IsDefault { get; set; }
-
}
}
\ No newline at end of file
diff --git a/src/ElectronNET.API/API/Entities/SemVer.cs b/src/ElectronNET.API/API/Entities/SemVer.cs
index e1a08f1..abac145 100644
--- a/src/ElectronNET.API/API/Entities/SemVer.cs
+++ b/src/ElectronNET.API/API/Entities/SemVer.cs
@@ -8,35 +8,43 @@
///
///
///
- public string Raw { get; set; }
+ public string Raw { get; set; }
+
///
///
///
public bool Loose { get; set; }
+
///
///
///
public SemVerOptions Options { get; set; }
+
///
///
///
public int Major { get; set; }
+
///
///
///
public int Minor { get; set; }
+
///
///
///
public int Patch { get; set; }
+
///
///
///
public string Version { get; set; }
+
///
///
///
public string[] Build { get; set; }
+
///
///
///
@@ -46,14 +54,16 @@
///
///
///
- public class SemVerOptions {
+ public class SemVerOptions
+ {
///
///
///
public bool? Loose { get; set; }
+
///
///
///
public bool? IncludePrerelease { get; set; }
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/API/Entities/UpdateCancellationToken.cs b/src/ElectronNET.API/API/Entities/UpdateCancellationToken.cs
index f89348c..84b9c3c 100644
--- a/src/ElectronNET.API/API/Entities/UpdateCancellationToken.cs
+++ b/src/ElectronNET.API/API/Entities/UpdateCancellationToken.cs
@@ -15,7 +15,6 @@
///
public void Cancel()
{
-
}
///
@@ -23,7 +22,6 @@
///
public void Dispose()
{
-
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/API/Entities/UploadRawData.cs b/src/ElectronNET.API/API/Entities/UploadRawData.cs
index d0a98de..c157797 100644
--- a/src/ElectronNET.API/API/Entities/UploadRawData.cs
+++ b/src/ElectronNET.API/API/Entities/UploadRawData.cs
@@ -9,7 +9,7 @@
/// The data is available as a Buffer, in the rawData field.
///
public string Type { get; } = "rawData";
-
+
///
/// The raw bytes of the post data in a Buffer.
///
diff --git a/src/ElectronNET.API/API/Extensions/EnumExtensions.cs b/src/ElectronNET.API/API/Extensions/EnumExtensions.cs
index 4424310..4260458 100644
--- a/src/ElectronNET.API/API/Extensions/EnumExtensions.cs
+++ b/src/ElectronNET.API/API/Extensions/EnumExtensions.cs
@@ -27,8 +27,9 @@ namespace ElectronNET.API.Extensions
return ((DescriptionAttribute)attrs[0]).Description;
}
}
+
//If we have no description attribute, just return the ToString of the enum
return enumerationValue.ToString();
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/API/Extensions/MenuItemExtensions.cs b/src/ElectronNET.API/API/Extensions/MenuItemExtensions.cs
index 37a5b9c..d011417 100644
--- a/src/ElectronNET.API/API/Extensions/MenuItemExtensions.cs
+++ b/src/ElectronNET.API/API/Extensions/MenuItemExtensions.cs
@@ -56,7 +56,7 @@ namespace ElectronNET.API.Extensions
var menuItem = menuItems[index];
if (menuItem?.Submenu?.Length > 0)
{
- if(menuItem.Type == MenuType.normal)
+ if (menuItem.Type == MenuType.normal)
{
menuItem.Type = MenuType.submenu;
}
@@ -68,4 +68,4 @@ namespace ElectronNET.API.Extensions
return menuItems;
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/API/GlobalShortcut.cs b/src/ElectronNET.API/API/GlobalShortcut.cs
index d2867ec..ec20d55 100644
--- a/src/ElectronNET.API/API/GlobalShortcut.cs
+++ b/src/ElectronNET.API/API/GlobalShortcut.cs
@@ -12,7 +12,9 @@ namespace ElectronNET.API
private static GlobalShortcut _globalShortcut;
private static object _syncRoot = new object();
- internal GlobalShortcut() { }
+ internal GlobalShortcut()
+ {
+ }
internal static GlobalShortcut Instance
{
diff --git a/src/ElectronNET.API/API/HostHook.cs b/src/ElectronNET.API/API/HostHook.cs
index 3760625..7f0dd62 100644
--- a/src/ElectronNET.API/API/HostHook.cs
+++ b/src/ElectronNET.API/API/HostHook.cs
@@ -17,9 +17,11 @@ namespace ElectronNET.API
{
private static HostHook _electronHostHook;
private static object _syncRoot = new object();
- string oneCallguid = Guid.NewGuid().ToString();
+ private string oneCallguid = Guid.NewGuid().ToString();
- internal HostHook() { }
+ internal HostHook()
+ {
+ }
internal static HostHook Instance
{
@@ -125,4 +127,4 @@ namespace ElectronNET.API
DefaultValueHandling = DefaultValueHandling.Ignore
};
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/API/IpcMain.cs b/src/ElectronNET.API/API/IpcMain.cs
index 31122d1..c4eed19 100644
--- a/src/ElectronNET.API/API/IpcMain.cs
+++ b/src/ElectronNET.API/API/IpcMain.cs
@@ -17,17 +17,19 @@ namespace ElectronNET.API
private static IpcMain _ipcMain;
private static object _syncRoot = new object();
- internal IpcMain() { }
+ internal IpcMain()
+ {
+ }
internal static IpcMain Instance
{
get
{
- if(_ipcMain == null)
+ if (_ipcMain == null)
{
lock (_syncRoot)
{
- if(_ipcMain == null)
+ if (_ipcMain == null)
{
_ipcMain = new IpcMain();
}
@@ -48,11 +50,11 @@ namespace ElectronNET.API
{
await BridgeConnector.Socket.Emit("registerIpcMainChannel", channel).ConfigureAwait(false);
BridgeConnector.Socket.Off(channel);
- BridgeConnector.Socket.On(channel, (args) =>
+ BridgeConnector.Socket.On(channel, (args) =>
{
List objectArray = FormatArguments(args);
- if(objectArray.Count == 1)
+ if (objectArray.Count == 1)
{
listener(objectArray.First());
}
@@ -91,7 +93,8 @@ namespace ElectronNET.API
public void OnSync(string channel, Func listener)
{
BridgeConnector.Socket.Emit("registerSyncIpcMainChannel", channel);
- BridgeConnector.Socket.On(channel, (args) => {
+ BridgeConnector.Socket.On(channel, (args) =>
+ {
List objectArray = FormatArguments(args);
object parameter;
if (objectArray.Count == 1)
@@ -158,19 +161,21 @@ namespace ElectronNET.API
foreach (var parameterObject in data)
{
- if(parameterObject.GetType().IsArray || parameterObject.GetType().IsGenericType && parameterObject is IEnumerable)
+ if (parameterObject.GetType().IsArray || parameterObject.GetType().IsGenericType && parameterObject is IEnumerable)
{
jarrays.Add(JArray.FromObject(parameterObject, _jsonSerializer));
- } else if(parameterObject.GetType().IsClass && !parameterObject.GetType().IsPrimitive && !(parameterObject is string))
+ }
+ else if (parameterObject.GetType().IsClass && !parameterObject.GetType().IsPrimitive && !(parameterObject is string))
{
jobjects.Add(JObject.FromObject(parameterObject, _jsonSerializer));
- } else if(parameterObject.GetType().IsPrimitive || (parameterObject is string))
+ }
+ else if (parameterObject.GetType().IsPrimitive || (parameterObject is string))
{
objects.Add(parameterObject);
}
}
- if(jobjects.Count > 0 || jarrays.Count > 0)
+ if (jobjects.Count > 0 || jarrays.Count > 0)
{
BridgeConnector.Socket.Emit("sendToIpcRenderer", JObject.FromObject(browserWindow, _jsonSerializer), channel, jarrays.ToArray(), jobjects.ToArray(), objects.ToArray());
}
@@ -197,19 +202,21 @@ namespace ElectronNET.API
foreach (var parameterObject in data)
{
- if(parameterObject.GetType().IsArray || parameterObject.GetType().IsGenericType && parameterObject is IEnumerable)
+ if (parameterObject.GetType().IsArray || parameterObject.GetType().IsGenericType && parameterObject is IEnumerable)
{
jarrays.Add(JArray.FromObject(parameterObject, _jsonSerializer));
- } else if(parameterObject.GetType().IsClass && !parameterObject.GetType().IsPrimitive && !(parameterObject is string))
+ }
+ else if (parameterObject.GetType().IsClass && !parameterObject.GetType().IsPrimitive && !(parameterObject is string))
{
jobjects.Add(JObject.FromObject(parameterObject, _jsonSerializer));
- } else if(parameterObject.GetType().IsPrimitive || (parameterObject is string))
+ }
+ else if (parameterObject.GetType().IsPrimitive || (parameterObject is string))
{
objects.Add(parameterObject);
}
}
- if(jobjects.Count > 0 || jarrays.Count > 0)
+ if (jobjects.Count > 0 || jarrays.Count > 0)
{
BridgeConnector.Socket.Emit("sendToIpcRendererBrowserView", browserView.Id, channel, jarrays.ToArray(), jobjects.ToArray(), objects.ToArray());
}
diff --git a/src/ElectronNET.API/API/Menu.cs b/src/ElectronNET.API/API/Menu.cs
index 8397a10..bb98d50 100644
--- a/src/ElectronNET.API/API/Menu.cs
+++ b/src/ElectronNET.API/API/Menu.cs
@@ -17,7 +17,9 @@ namespace ElectronNET.API
private static Menu _menu;
private static object _syncRoot = new object();
- internal Menu() { }
+ internal Menu()
+ {
+ }
internal static Menu Instance
{
@@ -27,7 +29,7 @@ namespace ElectronNET.API
{
lock (_syncRoot)
{
- if(_menu == null)
+ if (_menu == null)
{
_menu = new Menu();
}
@@ -44,7 +46,14 @@ namespace ElectronNET.API
///
/// The menu items.
///
- public IReadOnlyCollection MenuItems { get { return _menuItems.AsReadOnly(); } }
+ public IReadOnlyCollection MenuItems
+ {
+ get
+ {
+ return _menuItems.AsReadOnly();
+ }
+ }
+
private List _menuItems = new List();
///
@@ -62,7 +71,8 @@ namespace ElectronNET.API
_menuItems.AddRange(menuItems);
BridgeConnector.Socket.Off("menuItemClicked");
- BridgeConnector.Socket.On("menuItemClicked", (id) => {
+ BridgeConnector.Socket.On("menuItemClicked", (id) =>
+ {
MenuItem menuItem = _menuItems.GetMenuItem(id.ToString());
menuItem.Click?.Invoke();
});
@@ -75,6 +85,7 @@ namespace ElectronNET.API
/// The context menu items.
///
public IReadOnlyDictionary> ContextMenuItems { get; internal set; }
+
private Dictionary> _contextMenuItems = new Dictionary>();
///
@@ -122,4 +133,4 @@ namespace ElectronNET.API
NullValueHandling = NullValueHandling.Ignore
};
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/API/NativeTheme.cs b/src/ElectronNET.API/API/NativeTheme.cs
index 2dfd210..d38abc3 100644
--- a/src/ElectronNET.API/API/NativeTheme.cs
+++ b/src/ElectronNET.API/API/NativeTheme.cs
@@ -14,7 +14,9 @@ namespace ElectronNET.API
private static NativeTheme _nativeTheme;
private static object _syncRoot = new object();
- internal NativeTheme() { }
+ internal NativeTheme()
+ {
+ }
internal static NativeTheme Instance
{
@@ -129,7 +131,8 @@ namespace ElectronNET.API
{
var taskCompletionSource = new TaskCompletionSource();
- BridgeConnector.Socket.On("nativeTheme-shouldUseDarkColors-completed", (shouldUseDarkColors) => {
+ BridgeConnector.Socket.On("nativeTheme-shouldUseDarkColors-completed", (shouldUseDarkColors) =>
+ {
BridgeConnector.Socket.Off("nativeTheme-shouldUseDarkColors-completed");
taskCompletionSource.SetResult((bool)shouldUseDarkColors);
@@ -148,7 +151,8 @@ namespace ElectronNET.API
{
var taskCompletionSource = new TaskCompletionSource();
- BridgeConnector.Socket.On("nativeTheme-shouldUseHighContrastColors-completed", (shouldUseHighContrastColors) => {
+ BridgeConnector.Socket.On("nativeTheme-shouldUseHighContrastColors-completed", (shouldUseHighContrastColors) =>
+ {
BridgeConnector.Socket.Off("nativeTheme-shouldUseHighContrastColors-completed");
taskCompletionSource.SetResult((bool)shouldUseHighContrastColors);
@@ -167,7 +171,8 @@ namespace ElectronNET.API
{
var taskCompletionSource = new TaskCompletionSource();
- BridgeConnector.Socket.On("nativeTheme-shouldUseInvertedColorScheme-completed", (shouldUseInvertedColorScheme) => {
+ BridgeConnector.Socket.On("nativeTheme-shouldUseInvertedColorScheme-completed", (shouldUseInvertedColorScheme) =>
+ {
BridgeConnector.Socket.Off("nativeTheme-shouldUseInvertedColorScheme-completed");
taskCompletionSource.SetResult((bool)shouldUseInvertedColorScheme);
diff --git a/src/ElectronNET.API/API/Notification.cs b/src/ElectronNET.API/API/Notification.cs
index 68ac4e1..1913ee2 100644
--- a/src/ElectronNET.API/API/Notification.cs
+++ b/src/ElectronNET.API/API/Notification.cs
@@ -17,7 +17,9 @@ namespace ElectronNET.API
private static Notification _notification;
private static object _syncRoot = new object();
- internal Notification() { }
+ internal Notification()
+ {
+ }
internal static Notification Instance
{
@@ -61,9 +63,7 @@ namespace ElectronNET.API
isActionDefined = true;
BridgeConnector.Socket.Off("NotificationEventShow");
- BridgeConnector.Socket.On("NotificationEventShow", (id) => {
- _notificationOptions.Single(x => x.ShowID == id.ToString()).OnShow();
- });
+ BridgeConnector.Socket.On("NotificationEventShow", (id) => { _notificationOptions.Single(x => x.ShowID == id.ToString()).OnShow(); });
}
if (notificationOptions.OnClick != null)
@@ -72,9 +72,7 @@ namespace ElectronNET.API
isActionDefined = true;
BridgeConnector.Socket.Off("NotificationEventClick");
- BridgeConnector.Socket.On("NotificationEventClick", (id) => {
- _notificationOptions.Single(x => x.ClickID == id.ToString()).OnClick();
- });
+ BridgeConnector.Socket.On("NotificationEventClick", (id) => { _notificationOptions.Single(x => x.ClickID == id.ToString()).OnClick(); });
}
if (notificationOptions.OnClose != null)
@@ -83,9 +81,7 @@ namespace ElectronNET.API
isActionDefined = true;
BridgeConnector.Socket.Off("NotificationEventClose");
- BridgeConnector.Socket.On("NotificationEventClose", (id) => {
- _notificationOptions.Single(x => x.CloseID == id.ToString()).OnClose();
- });
+ BridgeConnector.Socket.On("NotificationEventClose", (id) => { _notificationOptions.Single(x => x.CloseID == id.ToString()).OnClose(); });
}
if (notificationOptions.OnReply != null)
@@ -94,7 +90,8 @@ namespace ElectronNET.API
isActionDefined = true;
BridgeConnector.Socket.Off("NotificationEventReply");
- BridgeConnector.Socket.On("NotificationEventReply", (args) => {
+ BridgeConnector.Socket.On("NotificationEventReply", (args) =>
+ {
var arguments = ((JArray)args).ToObject();
_notificationOptions.Single(x => x.ReplyID == arguments[0].ToString()).OnReply(arguments[1].ToString());
});
@@ -106,7 +103,8 @@ namespace ElectronNET.API
isActionDefined = true;
BridgeConnector.Socket.Off("NotificationEventAction");
- BridgeConnector.Socket.On("NotificationEventAction", (args) => {
+ BridgeConnector.Socket.On("NotificationEventAction", (args) =>
+ {
var arguments = ((JArray)args).ToObject();
_notificationOptions.Single(x => x.ReplyID == arguments[0].ToString()).OnAction(arguments[1].ToString());
});
@@ -144,4 +142,4 @@ namespace ElectronNET.API
DefaultValueHandling = DefaultValueHandling.Ignore
};
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/API/PowerMonitor.cs b/src/ElectronNET.API/API/PowerMonitor.cs
index a42e5ac..36556c5 100644
--- a/src/ElectronNET.API/API/PowerMonitor.cs
+++ b/src/ElectronNET.API/API/PowerMonitor.cs
@@ -1,6 +1,7 @@
using System;
using System.Threading.Tasks;
using ElectronNET.Common;
+
// ReSharper disable InconsistentNaming
namespace ElectronNET.API
@@ -75,7 +76,7 @@ namespace ElectronNET.API
}
private event Action _onBattery;
-
+
///
/// 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
@@ -93,7 +94,9 @@ namespace ElectronNET.API
private static PowerMonitor _powerMonitor;
private static object _syncRoot = new object();
- internal PowerMonitor() { }
+ internal PowerMonitor()
+ {
+ }
internal static PowerMonitor Instance
{
@@ -114,4 +117,4 @@ namespace ElectronNET.API
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/API/Process.cs b/src/ElectronNET.API/API/Process.cs
index 26c0f2f..0be0181 100644
--- a/src/ElectronNET.API/API/Process.cs
+++ b/src/ElectronNET.API/API/Process.cs
@@ -12,7 +12,9 @@ namespace ElectronNET.API
///
public sealed class Process
{
- internal Process() { }
+ internal Process()
+ {
+ }
internal static Process Instance
{
@@ -102,13 +104,13 @@ namespace ElectronNET.API
return taskCompletionSource.Task;
}
}
-
-
+
+
///
/// The process.versions property returns an object listing the version strings of
/// chrome and electron.
///
- public Task VersionsAsync
+ public Task VersionsAsync
{
get
{
@@ -124,8 +126,8 @@ namespace ElectronNET.API
return taskCompletionSource.Task;
}
}
-
-
+
+
///
/// A Boolean. When app is started by being passed as parameter to the default app, this
/// property is true in the main process, otherwise it is false.
@@ -269,6 +271,5 @@ namespace ElectronNET.API
return taskCompletionSource.Task;
}
}
-
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/API/Screen.cs b/src/ElectronNET.API/API/Screen.cs
index 8f4ee0c..fd94372 100644
--- a/src/ElectronNET.API/API/Screen.cs
+++ b/src/ElectronNET.API/API/Screen.cs
@@ -51,7 +51,9 @@ namespace ElectronNET.API
private static Screen _screen;
private static object _syncRoot = new object();
- internal Screen() { }
+ internal Screen()
+ {
+ }
internal static Screen Instance
{
@@ -76,7 +78,7 @@ namespace ElectronNET.API
/// The current absolute position of the mouse pointer.
///
///
- public Task GetCursorScreenPointAsync()
+ public Task GetCursorScreenPointAsync()
{
var taskCompletionSource = new TaskCompletionSource();
diff --git a/src/ElectronNET.API/API/Session.cs b/src/ElectronNET.API/API/Session.cs
index a6acbc9..d5a1867 100644
--- a/src/ElectronNET.API/API/Session.cs
+++ b/src/ElectronNET.API/API/Session.cs
@@ -460,4 +460,4 @@ namespace ElectronNET.API
DefaultValueHandling = DefaultValueHandling.Ignore
};
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/API/Shell.cs b/src/ElectronNET.API/API/Shell.cs
index 71f458e..27d75ce 100644
--- a/src/ElectronNET.API/API/Shell.cs
+++ b/src/ElectronNET.API/API/Shell.cs
@@ -15,7 +15,9 @@ namespace ElectronNET.API
private static Shell _shell;
private static object _syncRoot = new object();
- internal Shell() { }
+ internal Shell()
+ {
+ }
internal static Shell Instance
{
@@ -44,10 +46,7 @@ namespace ElectronNET.API
{
var taskCompletionSource = new TaskCompletionSource();
- BridgeConnector.Socket.On("shell-showItemInFolderCompleted", () =>
- {
- BridgeConnector.Socket.Off("shell-showItemInFolderCompleted");
- });
+ BridgeConnector.Socket.On("shell-showItemInFolderCompleted", () => { BridgeConnector.Socket.Off("shell-showItemInFolderCompleted"); });
BridgeConnector.Socket.Emit("shell-showItemInFolder", fullPath);
@@ -67,7 +66,7 @@ namespace ElectronNET.API
{
BridgeConnector.Socket.Off("shell-openPathCompleted");
- taskCompletionSource.SetResult((string) errorMessage);
+ taskCompletionSource.SetResult((string)errorMessage);
});
BridgeConnector.Socket.Emit("shell-openPath", path);
@@ -101,7 +100,7 @@ namespace ElectronNET.API
{
BridgeConnector.Socket.Off("shell-openExternalCompleted");
- taskCompletionSource.SetResult((string) error);
+ taskCompletionSource.SetResult((string)error);
});
if (options == null)
@@ -129,7 +128,7 @@ namespace ElectronNET.API
{
BridgeConnector.Socket.Off("shell-trashItem-completed");
- taskCompletionSource.SetResult((bool) success);
+ taskCompletionSource.SetResult((bool)success);
});
BridgeConnector.Socket.Emit("shell-trashItem", fullPath);
@@ -160,7 +159,7 @@ namespace ElectronNET.API
{
BridgeConnector.Socket.Off("shell-writeShortcutLinkCompleted");
- taskCompletionSource.SetResult((bool) success);
+ taskCompletionSource.SetResult((bool)success);
});
BridgeConnector.Socket.Emit("shell-writeShortcutLink", shortcutPath, operation.GetDescription(), JObject.FromObject(options, _jsonSerializer));
@@ -200,4 +199,4 @@ namespace ElectronNET.API
DefaultValueHandling = DefaultValueHandling.Ignore
};
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/API/Tray.cs b/src/ElectronNET.API/API/Tray.cs
index f4d353d..7e55975 100644
--- a/src/ElectronNET.API/API/Tray.cs
+++ b/src/ElectronNET.API/API/Tray.cs
@@ -7,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using ElectronNET.Common;
+
// ReSharper disable InconsistentNaming
namespace ElectronNET.API
@@ -88,7 +89,9 @@ namespace ElectronNET.API
private static Tray _tray;
private static readonly object _syncRoot = new();
- internal Tray() { }
+ internal Tray()
+ {
+ }
internal static Tray Instance
{
@@ -239,6 +242,7 @@ namespace ElectronNET.API
};
private const string ModuleName = "tray";
+
///
/// Subscribe to an unmapped event on the module.
///
@@ -246,6 +250,7 @@ namespace ElectronNET.API
/// The handler
public void On(string eventName, Action action)
=> Events.Instance.On(ModuleName, eventName, action);
+
///
/// Subscribe to an unmapped event on the module.
///
@@ -253,6 +258,7 @@ namespace ElectronNET.API
/// The handler
public async Task On(string eventName, Action action)
=> await Events.Instance.On(ModuleName, eventName, action).ConfigureAwait(false);
+
///
/// Subscribe to an unmapped event on the module once.
///
@@ -260,6 +266,7 @@ namespace ElectronNET.API
/// The handler
public void Once(string eventName, Action action)
=> Events.Instance.Once(ModuleName, eventName, action);
+
///
/// Subscribe to an unmapped event on the module once.
///
@@ -268,4 +275,4 @@ namespace ElectronNET.API
public async Task Once(string eventName, Action action)
=> await Events.Instance.Once(ModuleName, eventName, action).ConfigureAwait(false);
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/API/WebContents.cs b/src/ElectronNET.API/API/WebContents.cs
index deaef8c..94cee55 100644
--- a/src/ElectronNET.API/API/WebContents.cs
+++ b/src/ElectronNET.API/API/WebContents.cs
@@ -5,6 +5,7 @@ using Newtonsoft.Json.Serialization;
using System;
using System.Threading.Tasks;
using ElectronNET.Common;
+
// ReSharper disable InconsistentNaming
namespace ElectronNET.API;
@@ -187,7 +188,7 @@ public class WebContents
taskCompletionSource.SetResult((bool)success);
});
- if(options == null)
+ if (options == null)
{
BridgeConnector.Socket.Emit("webContents-print", Id, "");
}
@@ -218,7 +219,7 @@ public class WebContents
taskCompletionSource.SetResult((bool)success);
});
- if(options == null)
+ if (options == null)
{
BridgeConnector.Socket.Emit("webContents-printToPDF", Id, "", path);
}
diff --git a/src/ElectronNET.API/API/WebRequest.cs b/src/ElectronNET.API/API/WebRequest.cs
index 3b55106..2aa448a 100644
--- a/src/ElectronNET.API/API/WebRequest.cs
+++ b/src/ElectronNET.API/API/WebRequest.cs
@@ -8,6 +8,7 @@ namespace ElectronNET.API.Entities
public int Id { get; set; }
public string Url { get; set; }
public string Method { get; set; }
+
public int? WebContentsId { get; set; }
// Ensure all necessary properties are included as per Electron documentation
}
@@ -34,14 +35,14 @@ namespace ElectronNET.API.Entities
{
BridgeConnector.Socket.On($"webContents-session-webRequest-onBeforeRequest{Id}",
(args) =>
- {
- ////var details = ((JObject)args[0]).ToObject();
- ////var callback = args.Length > 1 ? (Action)((response) => { BridgeConnector.Socket.Emit($"webContents-session-webRequest-onBeforeRequest-response{Id}", response); }) : null;
- var details = ((JObject)args).ToObject();
- var callback = (Action)((response) => { BridgeConnector.Socket.Emit($"webContents-session-webRequest-onBeforeRequest-response{Id}", response); });
+ {
+ ////var details = ((JObject)args[0]).ToObject();
+ ////var callback = args.Length > 1 ? (Action)((response) => { BridgeConnector.Socket.Emit($"webContents-session-webRequest-onBeforeRequest-response{Id}", response); }) : null;
+ var details = ((JObject)args).ToObject();
+ var callback = (Action)((response) => { BridgeConnector.Socket.Emit($"webContents-session-webRequest-onBeforeRequest-response{Id}", response); });
- _onBeforeRequest?.Invoke(details, callback);
- });
+ _onBeforeRequest?.Invoke(details, callback);
+ });
BridgeConnector.Socket.Emit("register-webContents-session-webRequest-onBeforeRequest", Id, JObject.FromObject(filter));
}
diff --git a/src/ElectronNET.API/API/WindowManager.cs b/src/ElectronNET.API/API/WindowManager.cs
index 6ce36d5..9ec0369 100644
--- a/src/ElectronNET.API/API/WindowManager.cs
+++ b/src/ElectronNET.API/API/WindowManager.cs
@@ -19,7 +19,9 @@ namespace ElectronNET.API
private static WindowManager _windowManager;
private static readonly object SyncRoot = new();
- internal WindowManager() { }
+ internal WindowManager()
+ {
+ }
internal static WindowManager Instance
{
@@ -55,6 +57,7 @@ namespace ElectronNET.API
_isQuitOnWindowAllClosed = value;
}
}
+
private bool _isQuitOnWindowAllClosed = true;
///
@@ -214,4 +217,4 @@ namespace ElectronNET.API
NullValueHandling = NullValueHandling.Ignore
};
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/Bridge/Events.cs b/src/ElectronNET.API/Bridge/Events.cs
index 8bcff02..f2dca2c 100644
--- a/src/ElectronNET.API/Bridge/Events.cs
+++ b/src/ElectronNET.API/Bridge/Events.cs
@@ -16,7 +16,8 @@ namespace ElectronNET.API
private readonly TextInfo _textInfo = new CultureInfo("en-US", false).TextInfo;
private Events()
- { }
+ {
+ }
public static Events Instance
{
@@ -94,6 +95,5 @@ namespace ElectronNET.API
BridgeConnector.Socket.Once(listener, action);
await BridgeConnector.Socket.Emit(subscriber, eventName, listener).ConfigureAwait(false);
}
-
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/Bridge/SocketIOFacade.cs b/src/ElectronNET.API/Bridge/SocketIOFacade.cs
index 6432417..21c03ae 100644
--- a/src/ElectronNET.API/Bridge/SocketIOFacade.cs
+++ b/src/ElectronNET.API/Bridge/SocketIOFacade.cs
@@ -33,10 +33,7 @@ internal class SocketIoFacade
public void Connect()
{
- _socket.OnError += (sender, e) =>
- {
- Console.WriteLine($"BridgeConnector Error: {sender} {e}");
- };
+ _socket.OnError += (sender, e) => { Console.WriteLine($"BridgeConnector Error: {sender} {e}"); };
_socket.OnConnected += (_, _) =>
{
@@ -57,10 +54,7 @@ internal class SocketIoFacade
{
lock (_lockObj)
{
- _socket.On(eventName, _ =>
- {
- Task.Run(action);
- });
+ _socket.On(eventName, _ => { Task.Run(action); });
}
}
@@ -107,10 +101,10 @@ internal class SocketIoFacade
lock (_lockObj)
{
_socket.On(eventName, (socketIoResponse) =>
- {
- _socket.Off(eventName);
- Task.Run(() => action(socketIoResponse.GetValue()));
- });
+ {
+ _socket.Off(eventName);
+ Task.Run(() => action(socketIoResponse.GetValue()));
+ });
}
}
diff --git a/src/ElectronNET.API/Common/ApiEventManager.cs b/src/ElectronNET.API/Common/ApiEventManager.cs
index 4aed5c1..61ef2c7 100644
--- a/src/ElectronNET.API/Common/ApiEventManager.cs
+++ b/src/ElectronNET.API/Common/ApiEventManager.cs
@@ -14,15 +14,16 @@ internal static class ApiEventManager
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(string eventName, object id, Action callback, Action value, Func converter, string suffix = "")
{
if (callback == null)
@@ -34,9 +35,10 @@ internal static class ApiEventManager
});
BridgeConnector.Socket.Emit($"register-{eventName}{suffix}", id);
}
+
callback += value;
}
-
+
internal static void AddEvent(string eventName, object id, Action callback, Action value)
{
if (callback == null)
@@ -44,15 +46,16 @@ internal static class ApiEventManager
BridgeConnector.Socket.On(eventName + id, (args) => callback(args));
BridgeConnector.Socket.Emit($"register-{eventName}", 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 AddTrayEvent(string eventName, object id, Action callback, Action value)
{
if (callback == null)
@@ -74,7 +77,7 @@ internal static class ApiEventManager
callback -= value;
if (callback == null) BridgeConnector.Socket.Off(eventName + id);
}
-
+
internal static void AddScreenEvent(string eventName, object id, Action callback, Action value)
{
if (callback == null)
@@ -89,11 +92,10 @@ internal static class ApiEventManager
callback += value;
}
}
-
+
internal static void RemoveScreenEvent(string eventName, object id, Action callback, Action value)
{
callback -= value;
if (callback == null) BridgeConnector.Socket.Off(eventName + id);
}
-
}
\ No newline at end of file
diff --git a/src/ElectronNET.API/Runtime/Controllers/RuntimeControllerBase.cs b/src/ElectronNET.API/Runtime/Controllers/RuntimeControllerBase.cs
index c80c0d6..65c911a 100644
--- a/src/ElectronNET.API/Runtime/Controllers/RuntimeControllerBase.cs
+++ b/src/ElectronNET.API/Runtime/Controllers/RuntimeControllerBase.cs
@@ -20,7 +20,6 @@
protected override Task StartCore()
{
-
return Task.CompletedTask;
}
@@ -28,6 +27,5 @@
{
return Task.CompletedTask;
}
-
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/Runtime/Controllers/RuntimeControllerDotNetFirst.cs b/src/ElectronNET.API/Runtime/Controllers/RuntimeControllerDotNetFirst.cs
index 7b8e888..af615cf 100644
--- a/src/ElectronNET.API/Runtime/Controllers/RuntimeControllerDotNetFirst.cs
+++ b/src/ElectronNET.API/Runtime/Controllers/RuntimeControllerDotNetFirst.cs
@@ -68,7 +68,6 @@
private void SocketBridge_Ready(object sender, EventArgs e)
{
this.TransitionState(LifetimeState.Ready);
-
}
private void SocketBridge_Stopped(object sender, EventArgs e)
@@ -102,6 +101,5 @@
this.electronProcess.Stop();
return Task.CompletedTask;
}
-
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/Runtime/Controllers/RuntimeControllerElectronFirst.cs b/src/ElectronNET.API/Runtime/Controllers/RuntimeControllerElectronFirst.cs
index c8b9031..cc97cd0 100644
--- a/src/ElectronNET.API/Runtime/Controllers/RuntimeControllerElectronFirst.cs
+++ b/src/ElectronNET.API/Runtime/Controllers/RuntimeControllerElectronFirst.cs
@@ -103,6 +103,5 @@
this.socketBridge.Stop();
return Task.CompletedTask;
}
-
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/Runtime/Services/LifetimeServiceBase.cs b/src/ElectronNET.API/Runtime/Services/LifetimeServiceBase.cs
index 15c5823..90a1410 100644
--- a/src/ElectronNET.API/Runtime/Services/LifetimeServiceBase.cs
+++ b/src/ElectronNET.API/Runtime/Services/LifetimeServiceBase.cs
@@ -14,7 +14,9 @@
private LifetimeState state = LifetimeState.Uninitialized;
- protected LifetimeServiceBase() { }
+ protected LifetimeServiceBase()
+ {
+ }
public event EventHandler Starting;
@@ -132,4 +134,4 @@
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/Runtime/Services/SocketBridge/SocketBridgeService.cs b/src/ElectronNET.API/Runtime/Services/SocketBridge/SocketBridgeService.cs
index 1253051..fea9d0a 100644
--- a/src/ElectronNET.API/Runtime/Services/SocketBridge/SocketBridgeService.cs
+++ b/src/ElectronNET.API/Runtime/Services/SocketBridge/SocketBridgeService.cs
@@ -5,7 +5,7 @@
using ElectronNET.API;
using ElectronNET.Runtime.Data;
- internal class SocketBridgeService : LifetimeServiceBase
+ internal class SocketBridgeService : LifetimeServiceBase
{
private readonly int socketPort;
private readonly string socketUrl;
@@ -53,4 +53,4 @@
this.TransitionState(LifetimeState.Ready);
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.API/Runtime/StartupManager.cs b/src/ElectronNET.API/Runtime/StartupManager.cs
index 7407714..a405a6e 100644
--- a/src/ElectronNET.API/Runtime/StartupManager.cs
+++ b/src/ElectronNET.API/Runtime/StartupManager.cs
@@ -103,7 +103,7 @@
{
ElectronNetRuntime.ElectronProcessId = result;
- Console.WriteLine("Electron Process ID: " + result);
+ Console.WriteLine("Electron Process ID: " + result);
}
}
}
@@ -122,7 +122,6 @@
}
ElectronNetRuntime.ElectronExecutable = executable;
-
}
private BuildInfo GatherBuildInfo()
@@ -166,4 +165,4 @@
return buildInfo;
}
}
-}
+}
\ No newline at end of file
diff --git a/src/ElectronNET.AspNet/Runtime/Services/AspNetLifetimeAdapter.cs b/src/ElectronNET.AspNet/Runtime/Services/AspNetLifetimeAdapter.cs
index 9971ed5..6922df4 100644
--- a/src/ElectronNET.AspNet/Runtime/Services/AspNetLifetimeAdapter.cs
+++ b/src/ElectronNET.AspNet/Runtime/Services/AspNetLifetimeAdapter.cs
@@ -5,7 +5,7 @@
using ElectronNET.Runtime.Services;
using Microsoft.Extensions.Hosting;
- internal class AspNetLifetimeAdapter : LifetimeServiceBase
+ internal class AspNetLifetimeAdapter : LifetimeServiceBase
{
private readonly IHostApplicationLifetime lifetimeService;
@@ -24,4 +24,4 @@
return Task.CompletedTask;
}
}
-}
+}
\ No newline at end of file