diff --git a/ElectronNET.API/App.cs b/ElectronNET.API/App.cs
old mode 100644
new mode 100755
index 69d8722c..31926206
--- a/ElectronNET.API/App.cs
+++ b/ElectronNET.API/App.cs
@@ -7,13 +7,14 @@
using System.Threading;
using System.Threading.Tasks;
using ElectronNET.API.Extensions;
+using ElectronNET.API.Interfaces;
namespace ElectronNET.API
{
///
/// Control your application's event lifecycle.
///
- public sealed class App
+ public sealed class App : IApp
{
///
/// Emitted when all windows have been closed.
diff --git a/ElectronNET.API/ApplicationSocket.cs b/ElectronNET.API/ApplicationSocket.cs
new file mode 100755
index 00000000..7480b802
--- /dev/null
+++ b/ElectronNET.API/ApplicationSocket.cs
@@ -0,0 +1,16 @@
+using ElectronNET.API.Interfaces;
+using Quobject.SocketIoClientDotNet.Client;
+
+namespace ElectronNET.API
+{
+ ///
+ /// Wrapper for the underlying Socket connection
+ ///
+ public class ApplicationSocket : IApplicationSocket
+ {
+ ///
+ /// Socket used to communicate with main.js
+ ///
+ public Socket Socket { get; internal set; }
+ }
+}
diff --git a/ElectronNET.API/AutoUpdater.cs b/ElectronNET.API/AutoUpdater.cs
old mode 100644
new mode 100755
index da1001fa..cf6a85d0
--- a/ElectronNET.API/AutoUpdater.cs
+++ b/ElectronNET.API/AutoUpdater.cs
@@ -5,13 +5,14 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using ElectronNET.API.Interfaces;
namespace ElectronNET.API
{
///
/// Enable apps to automatically update themselves. Based on electron-updater.
///
- public sealed class AutoUpdater
+ public sealed class AutoUpdater : IAutoUpdater
{
///
/// Whether to automatically download an update when it is found. (Default is true)
diff --git a/ElectronNET.API/BridgeConnector.cs b/ElectronNET.API/BridgeConnector.cs
index 08a84745..8c4d979d 100644
--- a/ElectronNET.API/BridgeConnector.cs
+++ b/ElectronNET.API/BridgeConnector.cs
@@ -1,5 +1,8 @@
-using Quobject.SocketIoClientDotNet.Client;
+using Newtonsoft.Json.Linq;
+using Quobject.SocketIoClientDotNet.Client;
using System;
+using System.Threading;
+using System.Threading.Tasks;
namespace ElectronNET.API
{
@@ -40,5 +43,110 @@ public static Socket Socket
return _socket;
}
}
+
+ public static async Task GetValueOverSocketAsync(string eventString, string eventCompletedString)
+ {
+ CancellationToken cancellationToken = new();
+ cancellationToken.ThrowIfCancellationRequested();
+
+ var taskCompletionSource = new TaskCompletionSource();
+ using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
+ {
+ BridgeConnector.Socket.On(eventCompletedString, (value) =>
+ {
+ BridgeConnector.Socket.Off(eventCompletedString);
+
+ if (value == null)
+ {
+ Console.WriteLine($"ERROR: BridgeConnector (event: '{eventString}') returned null. Socket loop hang.");
+ taskCompletionSource.SetCanceled();
+ return;
+ }
+
+ try
+ {
+ taskCompletionSource.SetResult( new JValue(value).ToObject() );
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine($"ERROR: BridgeConnector (event: '{eventString}') exception: {e.Message}. Socket loop hung.");
+ }
+ });
+
+ BridgeConnector.Socket.Emit(eventString);
+
+ return await taskCompletionSource.Task.ConfigureAwait(false);
+ }
+ }
+
+ public static async Task GetObjectOverSocketAsync(string eventString, string eventCompletedString)
+ {
+ CancellationToken cancellationToken = new();
+ cancellationToken.ThrowIfCancellationRequested();
+
+ var taskCompletionSource = new TaskCompletionSource();
+ using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
+ {
+ BridgeConnector.Socket.On(eventCompletedString, (value) =>
+ {
+ BridgeConnector.Socket.Off(eventCompletedString);
+
+ if (value == null)
+ {
+ Console.WriteLine($"ERROR: BridgeConnector (event: '{eventString}') returned null. Socket loop hang.");
+ taskCompletionSource.SetCanceled();
+ return;
+ }
+
+ try
+ {
+ taskCompletionSource.SetResult( ((JObject)value).ToObject() );
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine($"ERROR: BridgeConnector (event: '{eventString}') exception: {e.Message}. Socket loop hung.");
+ }
+ });
+
+ BridgeConnector.Socket.Emit(eventString);
+
+ return await taskCompletionSource.Task.ConfigureAwait(false);
+ }
+ }
+
+ public static async Task GetArrayOverSocketAsync(string eventString, string eventCompletedString)
+ {
+ CancellationToken cancellationToken = new();
+ cancellationToken.ThrowIfCancellationRequested();
+
+ var taskCompletionSource = new TaskCompletionSource();
+ using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
+ {
+ BridgeConnector.Socket.On(eventCompletedString, (value) =>
+ {
+ BridgeConnector.Socket.Off(eventCompletedString);
+ if (value == null)
+ {
+ Console.WriteLine($"ERROR: BridgeConnector (event: '{eventString}') returned null. Socket loop hang.");
+ taskCompletionSource.SetCanceled();
+ return;
+ }
+
+ try
+ {
+ taskCompletionSource.SetResult( ((JArray)value).ToObject() );
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine($"ERROR: BridgeConnector (event: '{eventString}') exception: {e.Message}. Socket loop hung.");
+ }
+ });
+
+ BridgeConnector.Socket.Emit(eventString);
+
+ return await taskCompletionSource.Task.ConfigureAwait(false);
+ }
+ }
+
}
}
diff --git a/ElectronNET.API/Clipboard.cs b/ElectronNET.API/Clipboard.cs
old mode 100644
new mode 100755
index e7535378..e8a70d4e
--- a/ElectronNET.API/Clipboard.cs
+++ b/ElectronNET.API/Clipboard.cs
@@ -3,13 +3,14 @@
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System.Threading.Tasks;
+using ElectronNET.API.Interfaces;
namespace ElectronNET.API
{
///
/// Perform copy and paste operations on the system clipboard.
///
- public sealed class Clipboard
+ public sealed class Clipboard : IClipboard
{
private static Clipboard _clipboard;
private static object _syncRoot = new object();
diff --git a/ElectronNET.API/Dialog.cs b/ElectronNET.API/Dialog.cs
old mode 100644
new mode 100755
index 7b626b4e..a68810a3
--- a/ElectronNET.API/Dialog.cs
+++ b/ElectronNET.API/Dialog.cs
@@ -6,13 +6,14 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Web;
+using ElectronNET.API.Interfaces;
namespace ElectronNET.API
{
///
/// Display native system dialogs for opening and saving files, alerting, etc.
///
- public sealed class Dialog
+ public sealed class Dialog : IDialog
{
private static Dialog _dialog;
private static object _syncRoot = new object();
diff --git a/ElectronNET.API/Dock.cs b/ElectronNET.API/Dock.cs
old mode 100644
new mode 100755
index 03276842..fa25d88a
--- a/ElectronNET.API/Dock.cs
+++ b/ElectronNET.API/Dock.cs
@@ -3,6 +3,7 @@
using System.Threading.Tasks;
using ElectronNET.API.Entities;
using ElectronNET.API.Extensions;
+using ElectronNET.API.Interfaces;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
@@ -12,7 +13,7 @@ namespace ElectronNET.API
///
/// Control your app in the macOS dock.
///
- public sealed class Dock
+ public sealed class Dock : IDock
{
private static Dock _dock;
private static object _syncRoot = new object();
diff --git a/ElectronNET.API/Electron.cs b/ElectronNET.API/Electron.cs
index 23f9902d..5c636164 100644
--- a/ElectronNET.API/Electron.cs
+++ b/ElectronNET.API/Electron.cs
@@ -88,5 +88,10 @@ public static class Electron
/// Control your app in the macOS dock.
///
public static Dock Dock { get { return Dock.Instance; } }
+
+ ///
+ /// Electeon extensions to the Nodejs process object.
+ ///
+ public static Process Process { get { return Process.Instance; } }
}
}
\ No newline at end of file
diff --git a/ElectronNET.API/ElectronNET.API.csproj b/ElectronNET.API/ElectronNET.API.csproj
old mode 100644
new mode 100755
diff --git a/ElectronNET.API/Entities/ProcessVersions.cs b/ElectronNET.API/Entities/ProcessVersions.cs
new file mode 100644
index 00000000..df41db65
--- /dev/null
+++ b/ElectronNET.API/Entities/ProcessVersions.cs
@@ -0,0 +1,10 @@
+namespace ElectronNET.API
+{
+ ///
+ /// An object listing the version strings specific to Electron
+ ///
+ /// Value representing Chrome's version string
+ /// Value representing Electron's version string
+ ///
+ public record ProcessVersions(string Chrome, string Electron);
+}
\ No newline at end of file
diff --git a/ElectronNET.API/GlobalShortcut.cs b/ElectronNET.API/GlobalShortcut.cs
old mode 100644
new mode 100755
index d2867ecd..0f6b522f
--- a/ElectronNET.API/GlobalShortcut.cs
+++ b/ElectronNET.API/GlobalShortcut.cs
@@ -1,13 +1,14 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
+using ElectronNET.API.Interfaces;
namespace ElectronNET.API
{
///
/// Detect keyboard events when the application does not have keyboard focus.
///
- public sealed class GlobalShortcut
+ public sealed class GlobalShortcut : IGlobalShortcut
{
private static GlobalShortcut _globalShortcut;
private static object _syncRoot = new object();
diff --git a/ElectronNET.API/HostHook.cs b/ElectronNET.API/HostHook.cs
old mode 100644
new mode 100755
index 37606250..0470dcee
--- a/ElectronNET.API/HostHook.cs
+++ b/ElectronNET.API/HostHook.cs
@@ -3,6 +3,7 @@
using Newtonsoft.Json.Serialization;
using System;
using System.Threading.Tasks;
+using ElectronNET.API.Interfaces;
namespace ElectronNET.API
{
@@ -13,7 +14,7 @@ namespace ElectronNET.API
/// ElectronHostHook directory:
/// electronize add HostHook
///
- public sealed class HostHook
+ public sealed class HostHook : IHostHook
{
private static HostHook _electronHostHook;
private static object _syncRoot = new object();
diff --git a/ElectronNET.API/Interfaces/IApp.cs b/ElectronNET.API/Interfaces/IApp.cs
new file mode 100755
index 00000000..abaee747
--- /dev/null
+++ b/ElectronNET.API/Interfaces/IApp.cs
@@ -0,0 +1,713 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using ElectronNET.API.Entities;
+
+namespace ElectronNET.API.Interfaces
+{
+ ///
+ /// Control your application's event lifecycle.
+ ///
+ public interface IApp
+ {
+ ///
+ /// Emitted when all windows have been closed.
+ ///
+ /// If you do not subscribe to this event and all windows are closed, the default behavior is to quit
+ /// the app; however, if you subscribe, you control whether the app quits or not.If the user pressed
+ /// Cmd + Q, or the developer called , Electron will first try to close all the windows
+ /// and then emit the event, and in this case the event
+ /// would not be emitted.
+ ///
+ event Action WindowAllClosed;
+
+ ///
+ /// Emitted before the application starts closing its windows.
+ ///
+ /// Note: If application quit was initiated by then
+ /// is emitted after emitting close event on all windows and closing them.
+ ///
+ /// Note: On Windows, this event will not be emitted if the app is closed due to a shutdown/restart of the system or a user logout.
+ ///
+ event Func BeforeQuit;
+
+ ///
+ /// Emitted when all windows have been closed and the application will quit.
+ ///
+ /// See the description of the event for the differences between the
+ /// and events.
+ ///
+ /// Note: On Windows, this event will not be emitted if the app is closed due to a shutdown/restart of the system or a user logout.
+ ///
+ event Func WillQuit;
+
+ ///
+ /// Emitted when the application is quitting.
+ ///
+ /// Note: On Windows, this event will not be emitted if the app is closed due to a shutdown/restart of the system or a user logout.
+ ///
+ event Func Quitting;
+
+ ///
+ /// Emitted when a blurred.
+ ///
+ event Action BrowserWindowBlur;
+
+ ///
+ /// Emitted when a gets focused.
+ ///
+ event Action BrowserWindowFocus;
+
+ ///
+ /// Emitted when a new is created.
+ ///
+ event Action BrowserWindowCreated;
+
+ ///
+ /// Emitted when a new is created.
+ ///
+ event Action WebContentsCreated;
+
+ ///
+ /// Emitted when Chrome’s accessibility support changes. This event fires when assistive technologies, such as
+ /// screen readers, are enabled or disabled. See https://www.chromium.org/developers/design-documents/accessibility for more details.
+ ///
+ /// when Chrome's accessibility support is enabled, otherwise.
+ event Action AccessibilitySupportChanged;
+
+ ///
+ /// Emitted when the application has finished basic startup.
+ ///
+ event Action Ready;
+
+ ///
+ /// Application host fully started.
+ ///
+ bool IsReady { get; }
+
+ ///
+ /// A property that indicates the current application's name, which is the name in the
+ /// application's package.json file.
+ ///
+ /// Usually the name field of package.json is a short lowercase name, according to the npm modules spec. You
+ /// should usually also specify a productName field, which is your application's full capitalized name, and
+ /// which will be preferred over name by Electron.
+ ///
+ string Name
+ {
+ [Obsolete("Use the asynchronous version NameAsync instead")]
+ get;
+ set;
+ }
+
+ ///
+ /// A property that indicates the current application's name, which is the name in the
+ /// application's package.json file.
+ ///
+ /// Usually the name field of package.json is a short lowercase name, according to the npm modules spec. You
+ /// should usually also specify a productName field, which is your application's full capitalized name, and
+ /// which will be preferred over name by Electron.
+ ///
+ Task NameAsync { get; }
+
+ ///
+ /// A object that allows you to read and manipulate the command line arguments that Chromium uses.
+ ///
+ CommandLine CommandLine { get; }
+
+ ///
+ /// A which is the user agent string Electron will use as a global fallback.
+ ///
+ /// This is the user agent that will be used when no user agent is set at the webContents or
+ /// session level. It is useful for ensuring that your entire app has the same user agent. Set to a
+ /// custom value as early as possible in your app's initialization to ensure that your overridden value
+ /// is used.
+ ///
+ string UserAgentFallback
+ {
+ [Obsolete("Use the asynchronous version UserAgentFallbackAsync instead")]
+ get;
+ set;
+ }
+
+ ///
+ /// A which is the user agent string Electron will use as a global fallback.
+ ///
+ /// This is the user agent that will be used when no user agent is set at the webContents or
+ /// session level. It is useful for ensuring that your entire app has the same user agent. Set to a
+ /// custom value as early as possible in your app's initialization to ensure that your overridden value
+ /// is used.
+ ///
+ Task UserAgentFallbackAsync { get; }
+
+ ///
+ /// Emitted when a MacOS user wants to open a file with the application. The open-file event is usually emitted
+ /// when the application is already open and the OS wants to reuse the application to open the file.
+ /// open-file is also emitted when a file is dropped onto the dock and the application is not yet running.
+ ///
+ /// On Windows, you have to parse the arguments using App.CommandLine to get the filepath.
+ ///
+ event Action OpenFile;
+
+ ///
+ /// Emitted when a MacOS user wants to open a URL with the application. Your application's Info.plist file must
+ /// define the URL scheme within the CFBundleURLTypes key, and set NSPrincipalClass to AtomApplication.
+ ///
+ event Action OpenUrl;
+
+ ///
+ /// Try to close all windows. The event will be emitted first. If all windows are successfully
+ /// closed, the event will be emitted and by default the application will terminate. This method
+ /// guarantees that all beforeunload and unload event handlers are correctly executed. It is possible
+ /// that a window cancels the quitting by returning in the beforeunload event handler.
+ ///
+ void Quit();
+
+ ///
+ /// All windows will be closed immediately without asking user and the and
+ /// events will not be emitted.
+ ///
+ /// Exits immediately with exitCode. exitCode defaults to 0.
+ void Exit(int exitCode = 0);
+
+ ///
+ /// Relaunches the app when current instance exits. By default the new instance will use the same working directory
+ /// and command line arguments with current instance.
+ ///
+ /// Note that this method does not quit the app when executed, you have to call or
+ /// after calling to make the app restart.
+ ///
+ /// When is called for multiple times, multiple instances will be started after current instance
+ /// exited.
+ ///
+ void Relaunch();
+
+ ///
+ /// Relaunches the app when current instance exits. By default the new instance will use the same working directory
+ /// and command line arguments with current instance. When is specified, the
+ /// will be passed as command line arguments instead. When
+ /// is specified, the will be executed for relaunch instead of current app.
+ ///
+ /// Note that this method does not quit the app when executed, you have to call or
+ /// after calling to make the app restart.
+ ///
+ /// When is called for multiple times, multiple instances will be started after current instance
+ /// exited.
+ ///
+ /// Options for the relaunch.
+ void Relaunch(RelaunchOptions relaunchOptions);
+
+ ///
+ /// On Linux, focuses on the first visible window. On macOS, makes the application the active app. On Windows, focuses
+ /// on the application's first window.
+ ///
+ void Focus();
+
+ ///
+ /// On Linux, focuses on the first visible window. On macOS, makes the application the active app. On Windows, focuses
+ /// on the application's first window.
+ ///
+ /// You should seek to use the option as sparingly as possible.
+ ///
+ void Focus(FocusOptions focusOptions);
+
+ ///
+ /// Hides all application windows without minimizing them.
+ ///
+ void Hide();
+
+ ///
+ /// Shows application windows after they were hidden. Does not automatically focus them.
+ ///
+ void Show();
+
+ ///
+ /// The current application directory.
+ ///
+ Task GetAppPathAsync(CancellationToken cancellationToken = default);
+
+ ///
+ /// Sets or creates a directory your app's logs which can then be manipulated with
+ /// or .
+ ///
+ /// Calling without a path parameter will result in this directory being set to
+ /// ~/Library/Logs/YourAppName on macOS, and inside the userData directory on Linux and Windows.
+ ///
+ /// A custom path for your logs. Must be absolute.
+ void SetAppLogsPath(string path);
+
+ ///
+ /// The path to a special directory. If is called without called
+ /// being called first, a default directory will be created equivalent
+ /// to calling without a path parameter.
+ ///
+ /// Special directory.
+ /// The cancellation token.
+ /// A path to a special directory or file associated with name.
+ Task GetPathAsync(PathName pathName, CancellationToken cancellationToken = default);
+
+ ///
+ /// Overrides the path to a special directory or file associated with name. If the path specifies a directory
+ /// that does not exist, an Error is thrown. In that case, the directory should be created with fs.mkdirSync or similar.
+ ///
+ /// You can only override paths of a name defined in .
+ ///
+ /// By default, web pages' cookies and caches will be stored under the directory. If you
+ /// want to change this location, you have to override the path before the
+ /// event of the module is emitted.
+ /// Special directory.
+ /// New path to a special directory.
+ ///
+ void SetPath(PathName name, string path);
+
+ ///
+ /// The version of the loaded application. If no version is found in the application’s package.json file,
+ /// the version of the current bundle or executable is returned.
+ ///
+ /// The version of the loaded application.
+ Task GetVersionAsync(CancellationToken cancellationToken = default);
+
+ ///
+ /// The current application locale. Possible return values are documented here.
+ ///
+ /// Note: When distributing your packaged app, you have to also ship the locales folder.
+ ///
+ /// Note: On Windows, you have to call it after the events gets emitted.
+ ///
+ /// The current application locale.
+ Task GetLocaleAsync(CancellationToken cancellationToken = default);
+
+ ///
+ /// Adds path to the recent documents list. This list is managed by the OS. On Windows you can visit the
+ /// list from the task bar, and on macOS you can visit it from dock menu.
+ ///
+ /// Path to add.
+ void AddRecentDocument(string path);
+
+ ///
+ /// Clears the recent documents list.
+ ///
+ void ClearRecentDocuments();
+
+ ///
+ /// Sets the current executable as the default handler for a protocol (aka URI scheme). It allows you to
+ /// integrate your app deeper into the operating system. Once registered, all links with your-protocol://
+ /// will be opened with the current executable. The whole link, including protocol, will be passed to your
+ /// application as a parameter.
+ ///
+ /// Note: On macOS, you can only register protocols that have been added to your app's info.plist, which
+ /// cannot be modified at runtime. However, you can change the file during build time via
+ /// Electron Forge,
+ /// Electron Packager, or by editing info.plist
+ /// with a text editor. Please refer to
+ /// Apple's documentation
+ /// for details.
+ ///
+ /// Note: In a Windows Store environment (when packaged as an appx) this API will return true for all calls but
+ /// the registry key it sets won't be accessible by other applications. In order to register your Windows Store
+ /// application as a default protocol handler you must declare the protocol in your manifest.
+ ///
+ /// The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme internally.
+ ///
+ ///
+ /// The name of your protocol, without ://. For example, if you want your app to handle electron:// links,
+ /// call this method with electron as the parameter.
+ /// The cancellation token.
+ /// Whether the call succeeded.
+ Task SetAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default);
+
+ ///
+ /// Sets the current executable as the default handler for a protocol (aka URI scheme). It allows you to
+ /// integrate your app deeper into the operating system. Once registered, all links with your-protocol://
+ /// will be opened with the current executable. The whole link, including protocol, will be passed to your
+ /// application as a parameter.
+ ///
+ /// Note: On macOS, you can only register protocols that have been added to your app's info.plist, which
+ /// cannot be modified at runtime. However, you can change the file during build time via
+ /// Electron Forge,
+ /// Electron Packager, or by editing info.plist
+ /// with a text editor. Please refer to
+ /// Apple's documentation
+ /// for details.
+ ///
+ /// Note: In a Windows Store environment (when packaged as an appx) this API will return true for all calls but
+ /// the registry key it sets won't be accessible by other applications. In order to register your Windows Store
+ /// application as a default protocol handler you must declare the protocol in your manifest.
+ ///
+ /// The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme internally.
+ ///
+ ///
+ /// The name of your protocol, without ://. For example, if you want your app to handle electron:// links,
+ /// call this method with electron as the parameter.
+ /// The path to the Electron executable. Defaults to process.execPath
+ /// The cancellation token.
+ /// Whether the call succeeded.
+ Task SetAsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default);
+
+ ///
+ /// Sets the current executable as the default handler for a protocol (aka URI scheme). It allows you to
+ /// integrate your app deeper into the operating system. Once registered, all links with your-protocol://
+ /// will be opened with the current executable. The whole link, including protocol, will be passed to your
+ /// application as a parameter.
+ ///
+ /// Note: On macOS, you can only register protocols that have been added to your app's info.plist, which
+ /// cannot be modified at runtime. However, you can change the file during build time via
+ /// Electron Forge,
+ /// Electron Packager, or by editing info.plist
+ /// with a text editor. Please refer to
+ /// Apple's documentation
+ /// for details.
+ ///
+ /// Note: In a Windows Store environment (when packaged as an appx) this API will return true for all calls but
+ /// the registry key it sets won't be accessible by other applications. In order to register your Windows Store
+ /// application as a default protocol handler you must declare the protocol in your manifest.
+ ///
+ /// The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme internally.
+ ///
+ ///
+ /// The name of your protocol, without ://. For example, if you want your app to handle electron:// links,
+ /// call this method with electron as the parameter.
+ /// The path to the Electron executable. Defaults to process.execPath
+ /// Arguments passed to the executable. Defaults to an empty array.
+ /// The cancellation token.
+ /// Whether the call succeeded.
+ Task SetAsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default);
+
+ ///
+ /// This method checks if the current executable as the default handler for a protocol (aka URI scheme).
+ /// If so, it will remove the app as the default handler.
+ ///
+ /// The name of your protocol, without ://.
+ /// The cancellation token.
+ /// Whether the call succeeded.
+ Task RemoveAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default);
+
+ ///
+ /// This method checks if the current executable as the default handler for a protocol (aka URI scheme).
+ /// If so, it will remove the app as the default handler.
+ ///
+ /// The name of your protocol, without ://.
+ /// Defaults to process.execPath.
+ /// The cancellation token.
+ /// Whether the call succeeded.
+ Task RemoveAsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default);
+
+ ///
+ /// This method checks if the current executable as the default handler for a protocol (aka URI scheme).
+ /// If so, it will remove the app as the default handler.
+ ///
+ /// The name of your protocol, without ://.
+ /// Defaults to process.execPath.
+ /// Defaults to an empty array.
+ /// The cancellation token.
+ /// Whether the call succeeded.
+ Task RemoveAsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default);
+
+ ///
+ /// This method checks if the current executable is the default handler for a protocol (aka URI scheme).
+ ///
+ /// Note: On macOS, you can use this method to check if the app has been registered as the default protocol
+ /// handler for a protocol. You can also verify this by checking ~/Library/Preferences/com.apple.LaunchServices.plist
+ /// on the macOS machine. Please refer to Apple's documentation
+ /// for details.
+ ///
+ /// The API uses the Windows Registry and LSCopyDefaultHandlerForURLScheme internally.
+ ///
+ /// The name of your protocol, without ://.
+ /// The cancellation token.
+ /// Whether the current executable is the default handler for a protocol (aka URI scheme).
+ Task IsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default);
+
+ ///
+ /// This method checks if the current executable is the default handler for a protocol (aka URI scheme).
+ ///
+ /// Note: On macOS, you can use this method to check if the app has been registered as the default protocol
+ /// handler for a protocol. You can also verify this by checking ~/Library/Preferences/com.apple.LaunchServices.plist
+ /// on the macOS machine. Please refer to Apple's documentation
+ /// for details.
+ ///
+ /// The API uses the Windows Registry and LSCopyDefaultHandlerForURLScheme internally.
+ ///
+ /// The name of your protocol, without ://.
+ /// Defaults to process.execPath.
+ /// The cancellation token.
+ /// Whether the current executable is the default handler for a protocol (aka URI scheme).
+ Task IsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default);
+
+ ///
+ /// This method checks if the current executable is the default handler for a protocol (aka URI scheme).
+ ///
+ /// Note: On macOS, you can use this method to check if the app has been registered as the default protocol
+ /// handler for a protocol. You can also verify this by checking ~/Library/Preferences/com.apple.LaunchServices.plist
+ /// on the macOS machine. Please refer to Apple's documentation
+ /// for details.
+ ///
+ /// The API uses the Windows Registry and LSCopyDefaultHandlerForURLScheme internally.
+ ///
+ /// The name of your protocol, without ://.
+ /// Defaults to process.execPath.
+ /// Defaults to an empty array.
+ /// The cancellation token.
+ /// Whether the current executable is the default handler for a protocol (aka URI scheme).
+ Task IsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default);
+
+ ///
+ /// Adds tasks to the category of the JumpList on Windows.
+ ///
+ /// Note: If you'd like to customize the Jump List even more use instead.
+ ///
+ /// Array of objects.
+ /// The cancellation token.
+ /// Whether the call succeeded.
+ Task SetUserTasksAsync(UserTask[] userTasks, CancellationToken cancellationToken = default);
+
+ ///
+ /// Jump List settings for the application.
+ ///
+ /// The cancellation token.
+ /// Jump List settings.
+ Task GetJumpListSettingsAsync(CancellationToken cancellationToken = default);
+
+ ///
+ /// Sets or removes a custom Jump List for the application. If categories is null the previously set custom
+ /// Jump List (if any) will be replaced by the standard Jump List for the app (managed by Windows).
+ ///
+ /// Note: If a object has neither the nor
+ /// the property set then its is assumed
+ /// to be . If the property is set but
+ /// the property is omitted then the is
+ /// assumed to be .
+ ///
+ /// Note: Users can remove items from custom categories, and Windows will not allow a removed item to be added
+ /// back into a custom category until after the next successful call to . Any attempt
+ /// to re-add a removed item to a custom category earlier than that will result in the entire custom category being
+ /// omitted from the Jump List. The list of removed items can be obtained using .
+ ///
+ /// Array of objects.
+ void SetJumpList(JumpListCategory[] categories);
+
+ ///
+ /// The return value of this method indicates whether or not this instance of your application successfully obtained
+ /// the lock. If it failed to obtain the lock, you can assume that another instance of your application is already
+ /// running with the lock and exit immediately.
+ ///
+ /// I.e.This method returns if your process is the primary instance of your application and your
+ /// app should continue loading. It returns if your process should immediately quit as it has
+ /// sent its parameters to another instance that has already acquired the lock.
+ ///
+ /// On macOS, the system enforces single instance automatically when users try to open a second instance of your app
+ /// in Finder, and the open-file and open-url events will be emitted for that.However when users start your app in
+ /// command line, the system's single instance mechanism will be bypassed, and you have to use this method to ensure
+ /// single instance.
+ ///
+ /// Lambda with an array of the second instance’s command line arguments.
+ /// The second parameter is the working directory path.
+ /// The cancellation token.
+ /// This method returns false if your process is the primary instance of the application and your app
+ /// should continue loading. And returns true if your process has sent its parameters to another instance, and
+ /// you should immediately quit.
+ ///
+ Task RequestSingleInstanceLockAsync(Action newInstanceOpened, CancellationToken cancellationToken = default);
+
+ ///
+ /// Releases all locks that were created by makeSingleInstance. This will allow
+ /// multiple instances of the application to once again run side by side.
+ ///
+ void ReleaseSingleInstanceLock();
+
+ ///
+ /// This method returns whether or not this instance of your app is currently holding the single instance lock.
+ /// You can request the lock with and release with
+ /// .
+ ///
+ /// The cancellation token.
+ Task HasSingleInstanceLockAsync(CancellationToken cancellationToken = default);
+
+ ///
+ /// Creates an NSUserActivity and sets it as the current activity. The activity is
+ /// eligible for Handoff
+ /// to another device afterward.
+ ///
+ /// Uniquely identifies the activity. Maps to NSUserActivity.activityType.
+ /// App-specific state to store for use by another device.
+ void SetUserActivity(string type, object userInfo);
+
+ ///
+ /// Creates an NSUserActivity and sets it as the current activity. The activity is
+ /// eligible for Handoff
+ /// to another device afterward.
+ ///
+ ///
+ /// Uniquely identifies the activity. Maps to NSUserActivity.activityType.
+ ///
+ /// App-specific state to store for use by another device.
+ ///
+ /// The webpage to load in a browser if no suitable app is installed on the resuming device. The scheme must be http or https.
+ ///
+ void SetUserActivity(string type, object userInfo, string webpageUrl);
+
+ ///
+ /// The type of the currently running activity.
+ ///
+ /// The cancellation token.
+ Task GetCurrentActivityTypeAsync(CancellationToken cancellationToken = default);
+
+ ///
+ /// Invalidates the current Handoff user activity.
+ ///
+ void InvalidateCurrentActivity();
+
+ ///
+ /// Marks the current Handoff user activity as inactive without invalidating it.
+ ///
+ void ResignCurrentActivity();
+
+ ///
+ /// Changes the Application User Model ID to id.
+ ///
+ /// Model Id.
+ void SetAppUserModelId(string id);
+
+ /// TODO: Check new parameter which is a function [App.ImportCertificate]
+ ///
+ /// Imports the certificate in pkcs12 format into the platform certificate store.
+ /// callback is called with the result of import operation, a value of 0 indicates
+ /// success while any other value indicates failure according to chromium net_error_list.
+ ///
+ ///
+ /// The cancellation token.
+ /// Result of import. Value of 0 indicates success.
+ Task ImportCertificateAsync(ImportCertificateOptions options, CancellationToken cancellationToken = default);
+
+ ///
+ /// Memory and cpu usage statistics of all the processes associated with the app.
+ ///
+ ///
+ /// Array of ProcessMetric objects that correspond to memory and cpu usage
+ /// statistics of all the processes associated with the app.
+ /// The cancellation token.
+ ///
+ Task GetAppMetricsAsync(CancellationToken cancellationToken = default);
+
+ ///
+ /// The Graphics Feature Status from chrome://gpu/.
+ ///
+ /// Note: This information is only usable after the gpu-info-update event is emitted.
+ /// The cancellation token.
+ ///
+ Task GetGpuFeatureStatusAsync(CancellationToken cancellationToken = default);
+
+ ///
+ /// Sets the counter badge for current app. Setting the count to 0 will hide the badge.
+ /// On macOS it shows on the dock icon. On Linux it only works for Unity launcher.
+ ///
+ /// Note: Unity launcher requires the existence of a .desktop file to work, for more
+ /// information please read Desktop Environment Integration.
+ ///
+ /// Counter badge.
+ /// The cancellation token.
+ /// Whether the call succeeded.
+ Task SetBadgeCountAsync(int count, CancellationToken cancellationToken = default);
+
+ ///
+ /// The current value displayed in the counter badge.
+ ///
+ /// The cancellation token.
+ Task GetBadgeCountAsync(CancellationToken cancellationToken = default);
+
+ ///
+ /// Whether the current desktop environment is Unity launcher.
+ ///
+ /// The cancellation token.
+ Task IsUnityRunningAsync(CancellationToken cancellationToken = default);
+
+ ///
+ /// If you provided path and args options to then you need to pass the same
+ /// arguments here for to be set correctly.
+ ///
+ Task GetLoginItemSettingsAsync(CancellationToken cancellationToken = default);
+
+ ///
+ /// If you provided path and args options to then you need to pass the same
+ /// arguments here for to be set correctly.
+ ///
+ ///
+ /// The cancellation token.
+ Task GetLoginItemSettingsAsync(LoginItemSettingsOptions options, CancellationToken cancellationToken = default);
+
+ ///
+ /// Set the app's login item settings.
+ /// To work with Electron's autoUpdater on Windows, which uses Squirrel,
+ /// you'll want to set the launch path to Update.exe, and pass arguments that specify your application name.
+ ///
+ ///
+ void SetLoginItemSettings(LoginSettings loginSettings);
+
+ ///
+ /// if Chrome's accessibility support is enabled, otherwise. This API will
+ /// return if the use of assistive technologies, such as screen readers, has been detected.
+ /// See Chromium's accessibility docs for more details.
+ ///
+ /// if Chrome’s accessibility support is enabled, otherwise.
+ Task IsAccessibilitySupportEnabledAsync(CancellationToken cancellationToken = default);
+
+ ///
+ /// Manually enables Chrome's accessibility support, allowing to expose accessibility switch to users in application settings.
+ /// See Chromium's accessibility docs for more details.
+ /// Disabled () by default.
+ ///
+ /// This API must be called after the event is emitted.
+ ///
+ /// Note: Rendering accessibility tree can significantly affect the performance of your app. It should not be enabled by default.
+ ///
+ /// Enable or disable accessibility tree rendering.
+ void SetAccessibilitySupportEnabled(bool enabled);
+
+ ///
+ /// Show the app's about panel options. These options can be overridden with
+ /// .
+ ///
+ void ShowAboutPanel();
+
+ ///
+ /// Set the about panel options. This will override the values defined in the app's .plist file on macOS. See the
+ /// Apple docs
+ /// for more details. On Linux, values must be set in order to be shown; there are no defaults.
+ ///
+ /// If you do not set credits but still wish to surface them in your app, AppKit will look for a file named "Credits.html",
+ /// "Credits.rtf", and "Credits.rtfd", in that order, in the bundle returned by the NSBundle class method main. The first file
+ /// found is used, and if none is found, the info area is left blank. See Apple
+ /// documentation for more information.
+ ///
+ /// About panel options.
+ void SetAboutPanelOptions(AboutPanelOptions options);
+
+ ///
+ /// Subscribe to an unmapped event on the module.
+ ///
+ /// The event name
+ /// The handler
+ void On(string eventName, Action fn);
+
+ ///
+ /// Subscribe to an unmapped event on the module.
+ ///
+ /// The event name
+ /// The handler
+ void On(string eventName, Action