diff --git a/ElectronNET.API/App.cs b/ElectronNET.API/App.cs index 9f4c717a..194dd4b6 100644 --- a/ElectronNET.API/App.cs +++ b/ElectronNET.API/App.cs @@ -6,7 +6,7 @@ using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; -using Microsoft.Extensions.Hosting; +using ElectronNET.API.Extensions; namespace ElectronNET.API { @@ -17,13 +17,12 @@ public sealed class App { /// /// 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 app.quit(), Electron will first try to close - /// all the windows and then emit the will-quit event, and in this case the - /// window-all-closed event would not be emitted. + /// + /// 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. /// public event Action WindowAllClosed { @@ -56,9 +55,11 @@ public event Action WindowAllClosed /// /// Emitted before the application starts closing its windows. - /// - /// Note: If application quit was initiated by autoUpdater.quitAndInstall() then before-quit is emitted after - /// emitting close event on all windows and closing them. + /// + /// 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. /// public event Func BeforeQuit { @@ -125,10 +126,12 @@ public event Func BeforeQuit private event Func _beforeQuit; /// - /// Emitted when all windows have been closed and the application will quit. - /// - /// See the description of the window-all-closed event for the differences between the will-quit and - /// window-all-closed events. + /// 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. /// public event Func WillQuit { @@ -175,6 +178,8 @@ public 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. /// public event Func Quitting { @@ -207,7 +212,7 @@ public event Func Quitting private event Func _quitting; /// - /// Emitted when a BrowserWindow gets blurred. + /// Emitted when a blurred. /// public event Action BrowserWindowBlur { @@ -236,7 +241,7 @@ public event Action BrowserWindowBlur private event Action _browserWindowBlur; /// - /// Emitted when a BrowserWindow gets focused. + /// Emitted when a gets focused. /// public event Action BrowserWindowFocus { @@ -265,7 +270,7 @@ public event Action BrowserWindowFocus private event Action _browserWindowFocus; /// - /// Emitted when a new BrowserWindow is created. + /// Emitted when a new is created. /// public event Action BrowserWindowCreated { @@ -294,7 +299,7 @@ public event Action BrowserWindowCreated private event Action _browserWindowCreated; /// - /// Emitted when a new webContents is created. + /// Emitted when a new is created. /// public event Action WebContentsCreated { @@ -323,10 +328,10 @@ public event Action WebContentsCreated private 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. + /// 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. public event Action AccessibilitySupportChanged { add @@ -394,13 +399,12 @@ internal set private bool _isReady = false; /// - /// A property that indicates the current application's name, which is the - /// name in the application's `package.json` file. + /// 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. + /// 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. /// public string Name { @@ -454,18 +458,16 @@ internal static App Instance private static App _app; private static object _syncRoot = new object(); - private JsonSerializer _jsonSerializer = new JsonSerializer() + private readonly JsonSerializer _jsonSerializer = new JsonSerializer() { ContractResolver = new CamelCasePropertyNamesContractResolver() }; /// - /// Try to close all windows. The before-quit event will be emitted first. If all - /// windows are successfully closed, the will-quit 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 false in the beforeunload event - /// handler. + /// 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. /// public void Quit() { @@ -473,8 +475,8 @@ public void Quit() } /// - /// All windows will be closed immediately without asking user and - /// the before-quit and will-quit events will not be emitted. + /// 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. public void Exit(int exitCode = 0) @@ -483,14 +485,14 @@ public 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. - /// When args is specified, the args will be passed as command line arguments - /// instead. When execPath is specified, the execPath will be executed for relaunch - /// instead of current app. Note that this method does not quit the app when - /// executed, you have to call app.quit or app.exit after calling app.relaunch to - /// make the app restart. When app.relaunch is called for multiple times, multiple - /// instances will be started after current instance exited. + /// 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. /// public void Relaunch() { @@ -498,30 +500,43 @@ public 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 args is specified, the args will be passed as command line arguments - /// instead. When execPath is specified, the execPath will be executed for relaunch - /// instead of current app. Note that this method does not quit the app when - /// executed, you have to call app.quit or app.exit after calling app.relaunch to - /// make the app restart. When app.relaunch is called for multiple times, multiple - /// instances will be started after current instance exited. + /// 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. public void Relaunch(RelaunchOptions relaunchOptions) { BridgeConnector.Socket.Emit("appRelaunch", JObject.FromObject(relaunchOptions, _jsonSerializer)); } /// - /// 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. + /// 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. /// public void Focus() { BridgeConnector.Socket.Emit("appFocus"); } + /// + /// 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. + /// + public void Focus(FocusOptions focusOptions) + { + BridgeConnector.Socket.Emit("appFocus", JObject.FromObject(focusOptions, _jsonSerializer)); + } + /// /// Hides all application windows without minimizing them. /// @@ -541,8 +556,7 @@ public void Show() /// /// The current application directory. /// - /// - public async Task GetAppPathAsync(CancellationToken cancellationToken = default(CancellationToken)) + public async Task GetAppPathAsync(CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -563,10 +577,27 @@ public void Show() } /// - /// You can request the following paths by the name. + /// 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. + public void SetAppLogsPath(string path) + { + BridgeConnector.Socket.Emit("appSetAppLogsPath", 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. - public async Task GetPathAsync(PathName pathName, CancellationToken cancellationToken = default(CancellationToken)) + public async Task GetPathAsync(PathName pathName, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -580,34 +611,36 @@ public void Show() taskCompletionSource.SetResult(path.ToString()); }); - BridgeConnector.Socket.Emit("appGetPath", pathName.ToString()); + BridgeConnector.Socket.Emit("appGetPath", pathName.GetDescription()); return await taskCompletionSource.Task .ConfigureAwait(false); } } - /// - /// Overrides the path to a special directory or file associated with name. If the - /// path specifies a directory that does not exist, the directory will be created by - /// this method.On failure an Error is thrown.You can only override paths of a - /// name defined in app.getPath. By default, web pages' cookies and caches will be - /// stored under the userData directory.If you want to change this location, you - /// have to override the userData path before the ready event of the app module is emitted. + /// 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. /// - public void SetPath(string name, string path) + public void SetPath(PathName name, string path) { - BridgeConnector.Socket.Emit("appSetPath", name, path); + BridgeConnector.Socket.Emit("appSetPath", name.GetDescription(), path); } /// - /// The version of the loaded application. - /// If no version is found in the application’s package.json file, + /// 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. /// - /// - public async Task GetVersionAsync(CancellationToken cancellationToken = default(CancellationToken)) + /// The version of the loaded application. + public async Task GetVersionAsync(CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -628,12 +661,14 @@ public void SetPath(string name, string path) } /// - /// The current application locale. - /// Note: When distributing your packaged app, you have to also ship the locales - /// folder.Note: On Windows you have to call it after the ready events gets emitted. + /// 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. /// - /// - public async Task GetLocaleAsync(CancellationToken cancellationToken = default(CancellationToken)) + /// The current application locale. + public async Task GetLocaleAsync(CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -654,10 +689,10 @@ public void SetPath(string name, string path) } /// - /// 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. + /// 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. public void AddRecentDocument(string path) { BridgeConnector.Socket.Emit("appAddRecentDocument", path); @@ -672,106 +707,94 @@ public void ClearRecentDocuments() } /// - /// This method 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. On Windows you can provide optional parameters path, - /// the path to your executable, and args, an array of arguments to be passed to - /// your executable when it launches.Note: On macOS, you can only register - /// protocols that have been added to your app's info.plist, which can not be - /// modified at runtime.You can however change the file with a simple text editor - /// or script during build time. Please refer to Apple's documentation for details. - /// The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme - /// internally. - /// - /// The name of your protocol, without ://. - /// If you want your app to handle electron:// links, + /// 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. - public async Task SetAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default(CancellationToken)) - { - cancellationToken.ThrowIfCancellationRequested(); - - var taskCompletionSource = new TaskCompletionSource(); - using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) - { - BridgeConnector.Socket.On("appSetAsDefaultProtocolClientCompleted", (success) => - { - BridgeConnector.Socket.Off("appSetAsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); - }); - - BridgeConnector.Socket.Emit("appSetAsDefaultProtocolClient", protocol); - - return await taskCompletionSource.Task - .ConfigureAwait(false); - } - } - - /// - /// This method 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. On Windows you can provide optional parameters path, - /// the path to your executable, and args, an array of arguments to be passed to - /// your executable when it launches.Note: On macOS, you can only register - /// protocols that have been added to your app's info.plist, which can not be - /// modified at runtime.You can however change the file with a simple text editor - /// or script during build time. Please refer to Apple's documentation for details. - /// The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme - /// internally. - /// - /// The name of your protocol, without ://. - /// If you want your app to handle electron:// links, + public async Task SetAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default) + { + return await SetAsDefaultProtocolClientAsync(protocol, null, null, cancellationToken); + } + + /// + /// 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. - /// Defaults to process.execPath + /// The path to the Electron executable. Defaults to process.execPath /// The cancellation token. /// Whether the call succeeded. - public async Task SetAsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default(CancellationToken)) - { - cancellationToken.ThrowIfCancellationRequested(); - - var taskCompletionSource = new TaskCompletionSource(); - using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) - { - BridgeConnector.Socket.On("appSetAsDefaultProtocolClientCompleted", (success) => - { - BridgeConnector.Socket.Off("appSetAsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); - }); - - BridgeConnector.Socket.Emit("appSetAsDefaultProtocolClient", protocol, path); - - return await taskCompletionSource.Task - .ConfigureAwait(false); - } - } - - /// - /// This method 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. On Windows you can provide optional parameters path, - /// the path to your executable, and args, an array of arguments to be passed to - /// your executable when it launches.Note: On macOS, you can only register - /// protocols that have been added to your app's info.plist, which can not be - /// modified at runtime.You can however change the file with a simple text editor - /// or script during build time. Please refer to Apple's documentation for details. - /// The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme - /// internally. - /// - /// The name of your protocol, without ://. - /// If you want your app to handle electron:// links, + public async Task SetAsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default) + { + return await SetAsDefaultProtocolClientAsync(protocol, path, null, cancellationToken); + } + + /// + /// 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. - /// Defaults to process.execPath - /// Defaults to an empty array + /// 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. - public async Task SetAsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default(CancellationToken)) + public async Task SetAsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -781,7 +804,7 @@ public void ClearRecentDocuments() BridgeConnector.Socket.On("appSetAsDefaultProtocolClientCompleted", (success) => { BridgeConnector.Socket.Off("appSetAsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); + taskCompletionSource.SetResult((bool) success); }); BridgeConnector.Socket.Emit("appSetAsDefaultProtocolClient", protocol, path, args); @@ -792,70 +815,40 @@ public void ClearRecentDocuments() } /// - /// 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. + /// 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. - public async Task RemoveAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default(CancellationToken)) + public async Task RemoveAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default) { - cancellationToken.ThrowIfCancellationRequested(); - - var taskCompletionSource = new TaskCompletionSource(); - using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) - { - BridgeConnector.Socket.On("appRemoveAsDefaultProtocolClientCompleted", (success) => - { - BridgeConnector.Socket.Off("appRemoveAsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); - }); - - BridgeConnector.Socket.Emit("appRemoveAsDefaultProtocolClient", protocol); - - return await taskCompletionSource.Task - .ConfigureAwait(false); - } + return await RemoveAsDefaultProtocolClientAsync(protocol, null, null, cancellationToken); } /// - /// 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. + /// 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. - public async Task RemoveAsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default(CancellationToken)) + public async Task RemoveAsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default) { - cancellationToken.ThrowIfCancellationRequested(); - - var taskCompletionSource = new TaskCompletionSource(); - using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) - { - BridgeConnector.Socket.On("appRemoveAsDefaultProtocolClientCompleted", (success) => - { - BridgeConnector.Socket.Off("appRemoveAsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); - }); - - BridgeConnector.Socket.Emit("appRemoveAsDefaultProtocolClient", protocol, path); - - return await taskCompletionSource.Task - .ConfigureAwait(false); - } + return await RemoveAsDefaultProtocolClientAsync(protocol, path, null, cancellationToken); } /// - /// 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. + /// 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. - public async Task RemoveAsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default(CancellationToken)) + public async Task RemoveAsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -865,7 +858,7 @@ public void ClearRecentDocuments() BridgeConnector.Socket.On("appRemoveAsDefaultProtocolClientCompleted", (success) => { BridgeConnector.Socket.Off("appRemoveAsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); + taskCompletionSource.SetResult((bool) success); }); BridgeConnector.Socket.Emit("appRemoveAsDefaultProtocolClient", protocol, path, args); @@ -876,85 +869,58 @@ public void ClearRecentDocuments() } /// - /// This method checks if the current executable is the default handler for a - /// protocol(aka URI scheme). If so, it will return true. Otherwise, it will return - /// false. 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. + /// 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. - /// Returns Boolean - public async Task IsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default(CancellationToken)) + /// Whether the current executable is the default handler for a protocol (aka URI scheme). + public async Task IsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default) { - cancellationToken.ThrowIfCancellationRequested(); - - var taskCompletionSource = new TaskCompletionSource(); - using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) - { - BridgeConnector.Socket.On("appIsDefaultProtocolClientCompleted", (success) => - { - BridgeConnector.Socket.Off("appIsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); - }); - - BridgeConnector.Socket.Emit("appIsDefaultProtocolClient", protocol); - - return await taskCompletionSource.Task - .ConfigureAwait(false); - } + return await IsDefaultProtocolClientAsync(protocol, null, null, cancellationToken); } /// - /// This method checks if the current executable is the default handler for a - /// protocol(aka URI scheme). If so, it will return true. Otherwise, it will return - /// false. 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. + /// 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. - /// Returns Boolean - public async Task IsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default(CancellationToken)) + /// Whether the current executable is the default handler for a protocol (aka URI scheme). + public async Task IsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default) { - cancellationToken.ThrowIfCancellationRequested(); - - var taskCompletionSource = new TaskCompletionSource(); - using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) - { - BridgeConnector.Socket.On("appIsDefaultProtocolClientCompleted", (success) => - { - BridgeConnector.Socket.Off("appIsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); - }); - - BridgeConnector.Socket.Emit("appIsDefaultProtocolClient", protocol, path); - - return await taskCompletionSource.Task - .ConfigureAwait(false); - } + return await IsDefaultProtocolClientAsync(protocol, path, null, cancellationToken); } /// - /// This method checks if the current executable is the default handler for a - /// protocol(aka URI scheme). If so, it will return true. Otherwise, it will return - /// false. 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. + /// 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. - /// Returns Boolean - public async Task IsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default(CancellationToken)) + /// Whether the current executable is the default handler for a protocol (aka URI scheme). + public async Task IsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -964,7 +930,7 @@ public void ClearRecentDocuments() BridgeConnector.Socket.On("appIsDefaultProtocolClientCompleted", (success) => { BridgeConnector.Socket.Off("appIsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); + taskCompletionSource.SetResult((bool) success); }); BridgeConnector.Socket.Emit("appIsDefaultProtocolClient", protocol, path, args); @@ -975,14 +941,14 @@ public void ClearRecentDocuments() } /// - /// Adds tasks to the Tasks category of the JumpList on Windows. tasks is an array - /// of Task objects.Note: If you'd like to customize the Jump List even more use - /// app.setJumpList(categories) instead. + /// 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 Task objects. + /// Array of objects. /// The cancellation token. /// Whether the call succeeded. - public async Task SetUserTasksAsync(UserTask[] userTasks, CancellationToken cancellationToken = default(CancellationToken)) + public async Task SetUserTasksAsync(UserTask[] userTasks, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -992,10 +958,10 @@ public void ClearRecentDocuments() BridgeConnector.Socket.On("appSetUserTasksCompleted", (success) => { BridgeConnector.Socket.Off("appSetUserTasksCompleted"); - taskCompletionSource.SetResult((bool)success); + taskCompletionSource.SetResult((bool) success); }); - BridgeConnector.Socket.Emit("appSetUserTasks", JObject.FromObject(userTasks, _jsonSerializer)); + BridgeConnector.Socket.Emit("appSetUserTasks", JArray.FromObject(userTasks, _jsonSerializer)); return await taskCompletionSource.Task .ConfigureAwait(false); @@ -1005,18 +971,19 @@ public void ClearRecentDocuments() /// /// Jump List settings for the application. /// - /// - public async Task GetJumpListSettingsAsync(CancellationToken cancellationToken = default(CancellationToken)) + /// The cancellation token. + /// Jump List settings. + public async Task GetJumpListSettingsAsync(CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); var taskCompletionSource = new TaskCompletionSource(); using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.On("appGetJumpListSettingsCompleted", (jumplistSettings) => + BridgeConnector.Socket.On("appGetJumpListSettingsCompleted", (jumpListSettings) => { BridgeConnector.Socket.Off("appGetJumpListSettingsCompleted"); - taskCompletionSource.SetResult(JObject.Parse(jumplistSettings.ToString()).ToObject()); + taskCompletionSource.SetResult(JObject.Parse(jumpListSettings.ToString()).ToObject()); }); BridgeConnector.Socket.Emit("appGetJumpListSettings"); @@ -1027,51 +994,48 @@ public void ClearRecentDocuments() } /// - /// Sets or removes a custom Jump List for the application, and returns one of the - /// following strings: 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 JumpListCategory object has neither the type nor the name - /// property set then its type is assumed to be tasks.If the name property is set - /// but the type property is omitted then the type is assumed to be custom. 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 app.setJumpList(categories). 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 app.getJumpListSettings(). - /// - /// - public void SetJumpList(JumpListCategory[] jumpListCategories) - { - BridgeConnector.Socket.Emit("appSetJumpList", JObject.FromObject(jumpListCategories, _jsonSerializer)); - } - - /// - /// This method makes your application a Single Instance Application - instead of - /// allowing multiple instances of your app to run, this will ensure that only a - /// single instance of your app is running, and other instances signal this instance - /// and exit.callback will be called by the first instance with callback(argv, - /// workingDirectory) when a second instance has been executed.argv is an Array of - /// the second instance's command line arguments, and workingDirectory is its - /// current working directory.Usually applications respond to this by making their - /// primary window focused and non-minimized.The callback is guaranteed to be - /// executed after the ready event of app gets emitted.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.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. + /// 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. + public void SetJumpList(JumpListCategory[] categories) + { + BridgeConnector.Socket.Emit("appSetJumpList", JArray.FromObject(categories, _jsonSerializer)); + } + + /// + /// 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. - public async Task RequestSingleInstanceLockAsync(Action newInstanceOpened, CancellationToken cancellationToken = default(CancellationToken)) + /// 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. + /// + public async Task RequestSingleInstanceLockAsync(Action newInstanceOpened, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -1089,9 +1053,9 @@ public void SetJumpList(JumpListCategory[] jumpListCategories) { JArray results = (JArray)result; string[] args = results.First.ToObject(); - string workdirectory = results.Last.ToObject(); + string workingDirectory = results.Last.ToObject(); - newInstanceOpened(args, workdirectory); + newInstanceOpened(args, workingDirectory); }); BridgeConnector.Socket.Emit("appRequestSingleInstanceLock"); @@ -1110,34 +1074,66 @@ public void ReleaseSingleInstanceLock() BridgeConnector.Socket.Emit("appReleaseSingleInstanceLock"); } + /// + /// 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. + public async Task HasSingleInstanceLockAsync(CancellationToken cancellationToken = default) + { + cancellationToken.ThrowIfCancellationRequested(); + + var taskCompletionSource = new TaskCompletionSource(); + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) + { + BridgeConnector.Socket.On("appHasSingleInstanceLockCompleted", (hasLock) => + { + BridgeConnector.Socket.Off("appHasSingleInstanceLockCompleted"); + taskCompletionSource.SetResult((bool) hasLock); + }); + + BridgeConnector.Socket.Emit("appHasSingleInstanceLock"); + + return await taskCompletionSource.Task + .ConfigureAwait(false); + } + } + /// /// Creates an NSUserActivity and sets it as the current activity. The activity is - /// eligible for Handoff to another device afterward. + /// eligible for Handoff + /// to another device afterward. /// - /// Uniquely identifies the activity. Maps to NSUserActivity.activityType. + /// Uniquely identifies the activity. Maps to NSUserActivity.activityType. /// App-specific state to store for use by another device. public void SetUserActivity(string type, object userInfo) { - BridgeConnector.Socket.Emit("appSetUserActivity", type, userInfo); + SetUserActivity(type, userInfo, null); } /// /// Creates an NSUserActivity and sets it as the current activity. The activity is - /// eligible for Handoff to another device afterward. + /// eligible for Handoff + /// to another device afterward. /// - /// Uniquely identifies the activity. Maps to NSUserActivity.activityType. + /// + /// 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. - public void SetUserActivity(string type, object userInfo, string webpageURL) + /// + /// The webpage to load in a browser if no suitable app is installed on the resuming device. The scheme must be http or https. + /// + public void SetUserActivity(string type, object userInfo, string webpageUrl) { - BridgeConnector.Socket.Emit("appSetUserActivity", type, userInfo, webpageURL); + BridgeConnector.Socket.Emit("appSetUserActivity", type, userInfo, webpageUrl); } /// /// The type of the currently running activity. /// - /// - public async Task GetCurrentActivityTypeAsync(CancellationToken cancellationToken = default(CancellationToken)) + /// The cancellation token. + public async Task GetCurrentActivityTypeAsync(CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -1158,14 +1154,31 @@ public void SetUserActivity(string type, object userInfo, string webpageURL) } /// - /// Changes the Application User Model ID to id. + /// Invalidates the current Handoff user activity. /// - /// + public void InvalidateCurrentActivity() + { + BridgeConnector.Socket.Emit("appInvalidateCurrentActivity"); + } + + /// + /// Marks the current Handoff user activity as inactive without invalidating it. + /// + public void ResignCurrentActivity() + { + BridgeConnector.Socket.Emit("appResignCurrentActivity"); + } + + /// + /// Changes the Application User Model ID to id. + /// + /// Model Id. public void SetAppUserModelId(string id) { BridgeConnector.Socket.Emit("appSetAppUserModelId", 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 @@ -1174,7 +1187,7 @@ public void SetAppUserModelId(string id) /// /// The cancellation token. /// Result of import. Value of 0 indicates success. - public async Task ImportCertificateAsync(ImportCertificateOptions options, CancellationToken cancellationToken = default(CancellationToken)) + public async Task ImportCertificateAsync(ImportCertificateOptions options, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -1184,7 +1197,7 @@ public void SetAppUserModelId(string id) 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)); @@ -1197,9 +1210,12 @@ public void SetAppUserModelId(string id) /// /// 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. - public async Task GetAppMetricsAsync(CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Array of ProcessMetric objects that correspond to memory and cpu usage + /// statistics of all the processes associated with the app. + /// The cancellation token. + /// + public async Task GetAppMetricsAsync(CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -1223,9 +1239,11 @@ public void SetAppUserModelId(string id) /// /// The Graphics Feature Status from chrome://gpu/. + /// + /// Note: This information is only usable after the gpu-info-update event is emitted. + /// The cancellation token. /// - /// - public async Task GetGpuFeatureStatusAsync(CancellationToken cancellationToken = default(CancellationToken)) + public async Task GetGpuFeatureStatusAsync(CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -1248,13 +1266,16 @@ public void SetAppUserModelId(string id) } /// - /// 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. + /// 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. - public async Task SetBadgeCountAsync(int count, CancellationToken cancellationToken = default(CancellationToken)) + public async Task SetBadgeCountAsync(int count, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -1264,7 +1285,7 @@ public void SetAppUserModelId(string id) BridgeConnector.Socket.On("appSetBadgeCountCompleted", (success) => { BridgeConnector.Socket.Off("appSetBadgeCountCompleted"); - taskCompletionSource.SetResult((bool)success); + taskCompletionSource.SetResult((bool) success); }); BridgeConnector.Socket.Emit("appSetBadgeCount", count); @@ -1277,8 +1298,8 @@ public void SetAppUserModelId(string id) /// /// The current value displayed in the counter badge. /// - /// - public async Task GetBadgeCountAsync(CancellationToken cancellationToken = default(CancellationToken)) + /// The cancellation token. + public async Task GetBadgeCountAsync(CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -1299,15 +1320,15 @@ public void SetAppUserModelId(string id) } /// - /// Manipulate the command line arguments for your app that Chromium reads. + /// A object that allows you to read and manipulate the command line arguments that Chromium uses. /// public CommandLine CommandLine { get; internal set; } /// /// Whether the current desktop environment is Unity launcher. /// - /// - public async Task IsUnityRunningAsync(CancellationToken cancellationToken = default(CancellationToken)) + /// The cancellation token. + public async Task IsUnityRunningAsync(CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -1328,42 +1349,21 @@ public void SetAppUserModelId(string id) } /// - /// If you provided path and args options to app.setLoginItemSettings then you need - /// to pass the same arguments here for openAtLogin to be set correctly. Note: This - /// API has no effect on MAS builds. + /// If you provided path and args options to then you need to pass the same + /// arguments here for to be set correctly. /// - /// - public async Task GetLoginItemSettingsAsync(CancellationToken cancellationToken = default(CancellationToken)) + public async Task GetLoginItemSettingsAsync(CancellationToken cancellationToken = default) { - cancellationToken.ThrowIfCancellationRequested(); - - var taskCompletionSource = new TaskCompletionSource(); - using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) - { - BridgeConnector.Socket.On("appGetLoginItemSettingsCompleted", (loginItemSettings) => - { - BridgeConnector.Socket.Off("appGetLoginItemSettingsCompleted"); - - string jsonResult = ((JObject)loginItemSettings).ToString(); - taskCompletionSource.SetResult(JsonConvert.DeserializeObject(jsonResult)); - }); - - BridgeConnector.Socket.Emit("appGetLoginItemSettings"); - - return await taskCompletionSource.Task - .ConfigureAwait(false); - } + return await GetLoginItemSettingsAsync(null, cancellationToken); } /// - /// If you provided path and args options to app.setLoginItemSettings then you need - /// to pass the same arguments here for openAtLogin to be set correctly. Note: This - /// API has no effect on MAS builds. + /// 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. - /// - public async Task GetLoginItemSettingsAsync(LoginItemSettingsOptions options, CancellationToken cancellationToken = default(CancellationToken)) + public async Task GetLoginItemSettingsAsync(LoginItemSettingsOptions options, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -1373,10 +1373,20 @@ public void SetAppUserModelId(string id) BridgeConnector.Socket.On("appGetLoginItemSettingsCompleted", (loginItemSettings) => { BridgeConnector.Socket.Off("appGetLoginItemSettingsCompleted"); - taskCompletionSource.SetResult((LoginItemSettings)loginItemSettings); + + var result = ((JObject) loginItemSettings).ToObject(); + + taskCompletionSource.SetResult(result); }); - BridgeConnector.Socket.Emit("appGetLoginItemSettings", JObject.FromObject(options, _jsonSerializer)); + if (options == null) + { + BridgeConnector.Socket.Emit("appGetLoginItemSettings"); + } + else + { + BridgeConnector.Socket.Emit("appGetLoginItemSettings", JObject.FromObject(options, _jsonSerializer)); + } return await taskCompletionSource.Task .ConfigureAwait(false); @@ -1384,9 +1394,9 @@ public void SetAppUserModelId(string id) } /// - /// 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. + /// 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. /// /// public void SetLoginItemSettings(LoginSettings loginSettings) @@ -1395,12 +1405,12 @@ public void SetLoginItemSettings(LoginSettings loginSettings) } /// - /// This API will return true if the use of assistive technologies, - /// such as screen readers, has been detected. - /// See https://www.chromium.org/developers/design-documents/accessibility for more details. + /// 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. /// - /// true if Chrome’s accessibility support is enabled, false otherwise. - public async Task IsAccessibilitySupportEnabledAsync(CancellationToken cancellationToken = default(CancellationToken)) + /// if Chrome’s accessibility support is enabled, otherwise. + public async Task IsAccessibilitySupportEnabledAsync(CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); @@ -1421,156 +1431,52 @@ public void SetLoginItemSettings(LoginSettings loginSettings) } /// - /// Set the about panel options. This will override the values defined in the app's - /// .plist file. See the Apple docs for more details. + /// 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. /// - /// - public void SetAboutPanelOptions(AboutPanelOptions options) + /// Enable or disable accessibility tree rendering. + public void SetAccessibilitySupportEnabled(bool enabled) { - BridgeConnector.Socket.Emit("appSetAboutPanelOptions", JObject.FromObject(options, _jsonSerializer)); + BridgeConnector.Socket.Emit("appSetAboutPanelOptions", enabled); } /// - /// When critical is passed, the dock icon will bounce until either the application - /// becomes active or the request is canceled.When informational is passed, the - /// dock icon will bounce for one second.However, the request remains active until - /// either the application becomes active or the request is canceled. + /// Show the app's about panel options. These options can be overridden with + /// . /// - /// - /// - /// - public async Task DockBounceAsync(DockBounceType type, CancellationToken cancellationToken = default(CancellationToken)) + public void ShowAboutPanel() { - cancellationToken.ThrowIfCancellationRequested(); - - var taskCompletionSource = new TaskCompletionSource(); - using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) - { - BridgeConnector.Socket.On("appDockBounceCompleted", (id) => - { - BridgeConnector.Socket.Off("appDockBounceCompleted"); - taskCompletionSource.SetResult((int)id); - }); - - BridgeConnector.Socket.Emit("appDockBounce", type.ToString()); - - return await taskCompletionSource.Task - .ConfigureAwait(false); - } + BridgeConnector.Socket.Emit("appShowAboutPanel"); } /// - /// Cancel the bounce of id. + /// 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. /// - /// - public void DockCancelBounce(int id) - { - BridgeConnector.Socket.Emit("appDockCancelBounce", id); - } - - /// - /// Bounces the Downloads stack if the filePath is inside the Downloads folder. - /// - /// - public void DockDownloadFinished(string filePath) - { - BridgeConnector.Socket.Emit("appDockDownloadFinished", filePath); - } - - /// - /// Sets the string to be displayed in the dock’s badging area. - /// - /// - public void DockSetBadge(string text) - { - BridgeConnector.Socket.Emit("appDockSetBadge", text); - } - - /// - /// Gets the string to be displayed in the dock’s badging area. - /// - /// - public async Task DockGetBadgeAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - cancellationToken.ThrowIfCancellationRequested(); - - var taskCompletionSource = new TaskCompletionSource(); - using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) - { - BridgeConnector.Socket.On("appDockGetBadgeCompleted", (text) => - { - BridgeConnector.Socket.Off("appDockGetBadgeCompleted"); - taskCompletionSource.SetResult((string)text); - }); - - BridgeConnector.Socket.Emit("appDockGetBadge"); - - return await taskCompletionSource.Task - .ConfigureAwait(false); - } - } - - /// - /// Hides the dock icon. - /// - public void DockHide() - { - BridgeConnector.Socket.Emit("appDockHide"); - } - - /// - /// Shows the dock icon. - /// - public void DockShow() - { - BridgeConnector.Socket.Emit("appDockShow"); - } - - /// - /// Whether the dock icon is visible. The app.dock.show() call is asynchronous - /// so this method might not return true immediately after that call. - /// - /// - public async Task DockIsVisibleAsync(CancellationToken cancellationToken = default(CancellationToken)) - { - cancellationToken.ThrowIfCancellationRequested(); - - var taskCompletionSource = new TaskCompletionSource(); - using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) - { - BridgeConnector.Socket.On("appDockIsVisibleCompleted", (isVisible) => - { - BridgeConnector.Socket.Off("appDockIsVisibleCompleted"); - taskCompletionSource.SetResult((bool)isVisible); - }); - - BridgeConnector.Socket.Emit("appDockIsVisible"); - - return await taskCompletionSource.Task - .ConfigureAwait(false); - } - } - - // TODO: Menu lösung für macOS muss gemacht werden und imeplementiert - /// - /// Sets the application's dock menu. - /// - public void DockSetMenu() - { - BridgeConnector.Socket.Emit("appDockSetMenu"); - } - - /// - /// Sets the image associated with this dock icon. - /// - /// - public void DockSetIcon(string image) + /// About panel options. + public void SetAboutPanelOptions(AboutPanelOptions options) { - BridgeConnector.Socket.Emit("appDockSetIcon", image); + BridgeConnector.Socket.Emit("appSetAboutPanelOptions", JObject.FromObject(options, _jsonSerializer)); } /// - /// A String which is the user agent string Electron will use as a global fallback. + /// 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. /// public string UserAgentFallback { @@ -1604,4 +1510,4 @@ internal void PreventQuit() private bool _preventQuit = false; } -} +} \ No newline at end of file diff --git a/ElectronNET.API/Dock.cs b/ElectronNET.API/Dock.cs new file mode 100644 index 00000000..8a1a5ea6 --- /dev/null +++ b/ElectronNET.API/Dock.cs @@ -0,0 +1,206 @@ +using System.Threading; +using System.Threading.Tasks; +using ElectronNET.API.Entities; +using ElectronNET.API.Extensions; +using Newtonsoft.Json.Linq; + +namespace ElectronNET.API +{ + /// + /// Control your app in the macOS dock. + /// + public sealed class Dock + { + private static Dock _dock; + private static object _syncRoot = new object(); + + internal Dock() + { + } + + internal static Dock Instance + { + get + { + if (_dock == null) + { + lock (_syncRoot) + { + if (_dock == null) + { + _dock = new Dock(); + } + } + } + + return _dock; + } + } + + /// + /// When is passed, the dock icon will bounce until either the application becomes + /// active or the request is canceled. When is passed, the dock icon will bounce + /// for one second. However, the request remains active until either the application becomes active or the request is canceled. + /// + /// Note: This method can only be used while the app is not focused; when the app is focused it will return -1. + /// + /// Can be critical or informational. The default is informational. + /// The cancellation token. + /// Return an ID representing the request. + public async Task BounceAsync(DockBounceType type, CancellationToken cancellationToken = default) + { + cancellationToken.ThrowIfCancellationRequested(); + + var taskCompletionSource = new TaskCompletionSource(); + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) + { + BridgeConnector.Socket.On("dock-bounce-completed", (id) => + { + BridgeConnector.Socket.Off("dock-bounce-completed"); + taskCompletionSource.SetResult((int) id); + }); + + BridgeConnector.Socket.Emit("dock-bounce", type.GetDescription()); + + return await taskCompletionSource.Task + .ConfigureAwait(false); + } + } + + /// + /// Cancel the bounce of id. + /// + /// Id of the request. + public void CancelBounce(int id) + { + BridgeConnector.Socket.Emit("dock-cancelBounce", id); + } + + /// + /// Bounces the Downloads stack if the filePath is inside the Downloads folder. + /// + /// + public void DownloadFinished(string filePath) + { + BridgeConnector.Socket.Emit("dock-downloadFinished", filePath); + } + + /// + /// Sets the string to be displayed in the dock’s badging area. + /// + /// + public void SetBadge(string text) + { + BridgeConnector.Socket.Emit("dock-setBadge", text); + } + + /// + /// Gets the string to be displayed in the dock’s badging area. + /// + /// The cancellation token. + /// The badge string of the dock. + public async Task GetBadgeAsync(CancellationToken cancellationToken = default) + { + cancellationToken.ThrowIfCancellationRequested(); + + var taskCompletionSource = new TaskCompletionSource(); + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) + { + BridgeConnector.Socket.On("dock-getBadge-completed", (text) => + { + BridgeConnector.Socket.Off("dock-getBadge-completed"); + taskCompletionSource.SetResult((string) text); + }); + + BridgeConnector.Socket.Emit("dock-getBadge"); + + return await taskCompletionSource.Task + .ConfigureAwait(false); + } + } + + /// + /// Hides the dock icon. + /// + public void Hide() + { + BridgeConnector.Socket.Emit("dock-hide"); + } + + /// + /// Shows the dock icon. + /// + public void Show() + { + BridgeConnector.Socket.Emit("dock-show"); + } + + /// + /// Whether the dock icon is visible. The app.dock.show() call is asynchronous + /// so this method might not return true immediately after that call. + /// + /// The cancellation token. + /// Whether the dock icon is visible. + public async Task IsVisibleAsync(CancellationToken cancellationToken = default) + { + cancellationToken.ThrowIfCancellationRequested(); + + var taskCompletionSource = new TaskCompletionSource(); + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) + { + BridgeConnector.Socket.On("dock-isVisible-completed", (isVisible) => + { + BridgeConnector.Socket.Off("dock-isVisible-completed"); + taskCompletionSource.SetResult((bool) isVisible); + }); + + BridgeConnector.Socket.Emit("dock-isVisible"); + + return await taskCompletionSource.Task + .ConfigureAwait(false); + } + } + + /// + /// TODO: Menu (macOS) still to be implemented + /// Sets the application's dock menu. + /// + public void SetMenu() + { + BridgeConnector.Socket.Emit("dock-setMenu"); + } + + /// + /// TODO: Menu (macOS) still to be implemented + /// Gets the application's dock menu. + /// + public async Task GetMenu(CancellationToken cancellationToken = default) + { + cancellationToken.ThrowIfCancellationRequested(); + + var taskCompletionSource = new TaskCompletionSource(); + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) + { + BridgeConnector.Socket.On("dock-getMenu-completed", (menu) => + { + BridgeConnector.Socket.Off("dock-getMenu-completed"); + taskCompletionSource.SetResult(((JObject)menu).ToObject()); + }); + + BridgeConnector.Socket.Emit("dock-getMenu"); + + return await taskCompletionSource.Task + .ConfigureAwait(false); + } + } + + /// + /// Sets the image associated with this dock icon. + /// + /// + public void SetIcon(string image) + { + BridgeConnector.Socket.Emit("dock-setIcon", image); + } + } +} \ No newline at end of file diff --git a/ElectronNET.API/Electron.cs b/ElectronNET.API/Electron.cs index 730287d9..23f9902d 100644 --- a/ElectronNET.API/Electron.cs +++ b/ElectronNET.API/Electron.cs @@ -83,5 +83,10 @@ public static class Electron /// Read and respond to changes in Chromium's native color theme. /// public static NativeTheme NativeTheme { get { return NativeTheme.Instance; } } + + /// + /// Control your app in the macOS dock. + /// + public static Dock Dock { get { return Dock.Instance; } } } -} +} \ No newline at end of file diff --git a/ElectronNET.API/Entities/AboutPanelOptions.cs b/ElectronNET.API/Entities/AboutPanelOptions.cs index 4c17513a..90aeb869 100644 --- a/ElectronNET.API/Entities/AboutPanelOptions.cs +++ b/ElectronNET.API/Entities/AboutPanelOptions.cs @@ -1,7 +1,7 @@ namespace ElectronNET.API.Entities { /// - /// + /// About panel options. /// public class AboutPanelOptions { @@ -20,14 +20,29 @@ public class AboutPanelOptions /// public string Copyright { get; set; } + /// + /// The app's build version number. + /// + public string Version { get; set; } + /// /// Credit information. /// public string Credits { get; set; } /// - /// The app's build version number. + /// List of app authors. /// - public string Version { get; set; } + public string[] Authors { get; set; } + + /// + /// The app's website. + /// + public string Website { get; set; } + + /// + /// Path to the app's icon. On Linux, will be shown as 64x64 pixels while retaining aspect ratio. + /// + public string IconPath { get; set; } } } \ No newline at end of file diff --git a/ElectronNET.API/Entities/CPUUsage.cs b/ElectronNET.API/Entities/CPUUsage.cs index f76324dc..7225cae0 100644 --- a/ElectronNET.API/Entities/CPUUsage.cs +++ b/ElectronNET.API/Entities/CPUUsage.cs @@ -6,14 +6,14 @@ public class CPUUsage { /// - /// The number of average idle cpu wakeups per second since the last call to - /// getCPUUsage.First call returns 0. + /// Percentage of CPU used since the last call to getCPUUsage. First call returns 0. /// - public int IdleWakeupsPerSecond { get; set; } + public int PercentCPUUsage { get; set; } /// - /// Percentage of CPU used since the last call to getCPUUsage. First call returns 0. + /// The number of average idle cpu wakeups per second since the last call to + /// getCPUUsage.First call returns 0. /// - public int PercentCPUUsage { get; set; } + public int IdleWakeupsPerSecond { get; set; } } } diff --git a/ElectronNET.API/Entities/DockBounceType.cs b/ElectronNET.API/Entities/DockBounceType.cs index d3d0b82d..eedcaac3 100644 --- a/ElectronNET.API/Entities/DockBounceType.cs +++ b/ElectronNET.API/Entities/DockBounceType.cs @@ -1,18 +1,22 @@ -namespace ElectronNET.API +using System.ComponentModel; + +namespace ElectronNET.API.Entities { /// - /// + /// Defines the DockBounceType enumeration. /// public enum DockBounceType { /// - /// The critical + /// Dock icon will bounce until either the application becomes active or the request is canceled. /// - critical, + [Description("critical")] + Critical, /// - /// The informational + /// The dock icon will bounce for one second. /// - informational + [Description("informational")] + Informational } } \ No newline at end of file diff --git a/ElectronNET.API/Entities/FocusOptions.cs b/ElectronNET.API/Entities/FocusOptions.cs new file mode 100644 index 00000000..2520499f --- /dev/null +++ b/ElectronNET.API/Entities/FocusOptions.cs @@ -0,0 +1,15 @@ +namespace ElectronNET.API.Entities +{ + /// + /// Controls the behavior of . + /// + public class FocusOptions + { + /// + /// Make the receiver the active app even if another app is currently active. + /// + /// You should seek to use the option as sparingly as possible. + /// + public bool Steal { get; set; } + } +} \ No newline at end of file diff --git a/ElectronNET.API/Entities/GPUFeatureStatus.cs b/ElectronNET.API/Entities/GPUFeatureStatus.cs index a2521911..1681c4a8 100644 --- a/ElectronNET.API/Entities/GPUFeatureStatus.cs +++ b/ElectronNET.API/Entities/GPUFeatureStatus.cs @@ -8,77 +8,77 @@ namespace ElectronNET.API.Entities public class GPUFeatureStatus { /// - /// Canvas + /// Canvas. /// [JsonProperty("2d_canvas")] public string Canvas { get; set; } /// - /// Flash + /// Flash. /// [JsonProperty("flash_3d")] public string Flash3D { get; set; } /// - /// Flash Stage3D + /// Flash Stage3D. /// [JsonProperty("flash_stage3d")] public string FlashStage3D { get; set; } /// - /// Flash Stage3D Baseline profile + /// Flash Stage3D Baseline profile. /// [JsonProperty("flash_stage3d_baseline")] public string FlashStage3dBaseline { get; set; } /// - /// Compositing + /// Compositing. /// [JsonProperty("gpu_compositing")] public string GpuCompositing { get; set; } /// - /// Multiple Raster Threads + /// Multiple Raster Threads. /// [JsonProperty("multiple_raster_threads")] public string MultipleRasterThreads { get; set; } /// - /// Native GpuMemoryBuffers + /// Native GpuMemoryBuffers. /// [JsonProperty("native_gpu_memory_buffers")] public string NativeGpuMemoryBuffers { get; set; } /// - /// Rasterization + /// Rasterization. /// public string Rasterization { get; set; } /// - /// Video Decode + /// Video Decode. /// [JsonProperty("video_decode")] public string VideoDecode { get; set; } /// - /// Video Encode + /// Video Encode. /// [JsonProperty("video_encode")] public string VideoEncode { get; set; } /// - /// VPx Video Decode + /// VPx Video Decode. /// [JsonProperty("vpx_decode")] public string VpxDecode { get; set; } /// - /// WebGL + /// WebGL. /// public string Webgl { get; set; } /// - /// WebGL2 + /// WebGL2. /// public string Webgl2 { get; set; } } diff --git a/ElectronNET.API/Entities/JumpListCategory.cs b/ElectronNET.API/Entities/JumpListCategory.cs index 0a1f54cf..4c1bf92c 100644 --- a/ElectronNET.API/Entities/JumpListCategory.cs +++ b/ElectronNET.API/Entities/JumpListCategory.cs @@ -1,8 +1,7 @@ -using ElectronNET.API.Entities; -using Newtonsoft.Json; +using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace ElectronNET.API +namespace ElectronNET.API.Entities { /// /// @@ -25,4 +24,4 @@ public class JumpListCategory [JsonConverter(typeof(StringEnumConverter))] public JumpListCategoryType Type { get; set; } } -} +} \ No newline at end of file diff --git a/ElectronNET.API/Entities/JumpListCategoryType.cs b/ElectronNET.API/Entities/JumpListCategoryType.cs index 4b961122..56a18ddf 100644 --- a/ElectronNET.API/Entities/JumpListCategoryType.cs +++ b/ElectronNET.API/Entities/JumpListCategoryType.cs @@ -1,4 +1,4 @@ -namespace ElectronNET.API +namespace ElectronNET.API.Entities { /// /// diff --git a/ElectronNET.API/Entities/JumpListSettings.cs b/ElectronNET.API/Entities/JumpListSettings.cs index e56c1514..82184ed1 100644 --- a/ElectronNET.API/Entities/JumpListSettings.cs +++ b/ElectronNET.API/Entities/JumpListSettings.cs @@ -6,13 +6,16 @@ public class JumpListSettings { /// - /// The minimum number of items that will be shown in the Jump List (for a more detailed description of this value see the MSDN docs). + /// The minimum number of items that will be shown in the Jump List (for a more detailed description of this value see the + /// MSDN docs). /// public int MinItems { get; set; } = 0; /// - /// Array of JumpListItem objects that correspond to items that the user has explicitly removed from custom categories in the Jump List. These items must not be re-added to the Jump List in the next call to app.setJumpList(), Windows will not display any custom category that contains any of the removed items. + /// Array of JumpListItem objects that correspond to items that the user has explicitly removed from custom categories + /// in the Jump List. These items must not be re-added to the Jump List in the next call to , Windows will + /// not display any custom category that contains any of the removed items. /// public JumpListItem[] RemovedItems { get; set; } = new JumpListItem[0]; } -} +} \ No newline at end of file diff --git a/ElectronNET.API/Entities/LoginItemSettings.cs b/ElectronNET.API/Entities/LoginItemSettings.cs index c30ede6a..a744a624 100644 --- a/ElectronNET.API/Entities/LoginItemSettings.cs +++ b/ElectronNET.API/Entities/LoginItemSettings.cs @@ -6,33 +6,33 @@ public class LoginItemSettings { /// - /// true if the app is set to open at login. + /// if the app is set to open at login. /// public bool OpenAtLogin { get; set; } /// - /// true if the app is set to open as hidden at login. This setting is only - /// supported on macOS. + /// if the app is set to open as hidden at login. This setting is not available + /// on MAS builds. /// public bool OpenAsHidden { get; set; } /// - /// true if the app was opened at login automatically. This setting is only - /// supported on macOS. + /// if the app was opened at login automatically. This setting is not available + /// on MAS builds. /// public bool WasOpenedAtLogin { get; set; } /// - /// true if the app was opened as a hidden login item. This indicates that the app - /// should not open any windows at startup.This setting is only supported on macOS. + /// if the app was opened as a hidden login item. This indicates that the app should not + /// open any windows at startup. This setting is not available on + /// MAS builds. /// public bool WasOpenedAsHidden { get; set; } /// - /// true if the app was opened as a login item that should restore the state from - /// the previous session.This indicates that the app should restore the windows - /// that were open the last time the app was closed.This setting is only supported - /// on macOS. + /// if the app was opened as a login item that should restore the state from the previous + /// session. This indicates that the app should restore the windows that were open the last time the app was closed. + /// This setting is not available on MAS builds. /// public bool RestoreState { get; set; } } diff --git a/ElectronNET.API/Entities/LoginSettings.cs b/ElectronNET.API/Entities/LoginSettings.cs index b48011ea..994a9941 100644 --- a/ElectronNET.API/Entities/LoginSettings.cs +++ b/ElectronNET.API/Entities/LoginSettings.cs @@ -6,16 +6,15 @@ public class LoginSettings { /// - /// true to open the app at login, false to remove the app as a login item. Defaults - /// to false. + /// to open the app at login, to remove the app as a login item. + /// Defaults to . /// public bool OpenAtLogin { get; set; } /// - /// true to open the app as hidden. Defaults to false. The user can edit this - /// setting from the System Preferences so - /// app.getLoginItemStatus().wasOpenedAsHidden should be checked when the app is - /// opened to know the current value.This setting is only supported on macOS. + /// to open the app as hidden. Defaults to . The user can edit this + /// setting from the System Preferences so app.getLoginItemSettings().wasOpenedAsHidden should be checked when the app is + /// opened to know the current value. This setting is not available on MAS builds. /// public bool OpenAsHidden { get; set; } diff --git a/ElectronNET.API/Entities/MemoryInfo.cs b/ElectronNET.API/Entities/MemoryInfo.cs index ec791214..840cb5d7 100644 --- a/ElectronNET.API/Entities/MemoryInfo.cs +++ b/ElectronNET.API/Entities/MemoryInfo.cs @@ -6,31 +6,19 @@ public class MemoryInfo { /// - /// The maximum amount of memory that has ever been pinned to actual physical RAM. - /// On macOS its value will always be 0. + /// The amount of memory currently pinned to actual physical RAM. /// - public int PeakWorkingSetSize { get; set; } + public int WorkingSetSize { get; set; } /// - /// Process id of the process. + /// The maximum amount of memory that has ever been pinned to actual physical RAM. /// - public int Pid { get; set; } + public int PeakWorkingSetSize { get; set; } /// /// The amount of memory not shared by other processes, such as JS heap or HTML /// content. /// public int PrivateBytes { get; set; } - - /// - /// The amount of memory shared between processes, typically memory consumed by the - /// Electron code itself - /// - public int SharedBytes { get; set; } - - /// - /// The amount of memory currently pinned to actual physical RAM. - /// - public int WorkingSetSize {get; set; } } -} +} \ No newline at end of file diff --git a/ElectronNET.API/Entities/PathName.cs b/ElectronNET.API/Entities/PathName.cs index 560b9f93..e9500c21 100644 --- a/ElectronNET.API/Entities/PathName.cs +++ b/ElectronNET.API/Entities/PathName.cs @@ -1,79 +1,95 @@ -namespace ElectronNET.API.Entities +using System.ComponentModel; + +namespace ElectronNET.API.Entities { /// - /// + /// Defines the PathName enumeration. /// public enum PathName { /// /// User’s home directory. /// - home, + [Description("home")] + Home, /// /// Per-user application data directory. /// - appData, + [Description("appData")] + AppData, /// /// The directory for storing your app’s configuration files, /// which by default it is the appData directory appended with your app’s name. /// - userData, + [Description("userData")] + UserData, /// /// Temporary directory. /// - temp, + [Description("temp")] + Temp, /// /// The current executable file. /// - exe, + [Description("exe")] + Exe, /// /// The libchromiumcontent library. /// - module, + [Description("Module")] + Module, /// /// The current user’s Desktop directory. /// - desktop, + [Description("desktop")] + Desktop, /// /// Directory for a user’s “My Documents”. /// - documents, + [Description("documents")] + Documents, /// /// Directory for a user’s downloads. /// - downloads, + [Description("downloads")] + Downloads, /// /// Directory for a user’s music. /// - music, + [Description("music")] + Music, /// /// Directory for a user’s pictures. /// - pictures, + [Description("pictures")] + Pictures, /// /// Directory for a user’s videos. /// - videos, + [Description("videos")] + Videos, /// - /// The logs + /// The logs. /// - logs, + [Description("logs")] + Logs, /// /// Full path to the system version of the Pepper Flash plugin. /// - pepperFlashSystemPlugin + [Description("PepperFlashSystemPlugin")] + PepperFlashSystemPlugin } } diff --git a/ElectronNET.API/Entities/ProcessMetric.cs b/ElectronNET.API/Entities/ProcessMetric.cs index cf1973f4..ce9a8a18 100644 --- a/ElectronNET.API/Entities/ProcessMetric.cs +++ b/ElectronNET.API/Entities/ProcessMetric.cs @@ -5,24 +5,42 @@ /// public class ProcessMetric { - /// - /// CPU usage of the process. - /// - public CPUUsage Cpu { get; set; } + /// + /// Process id of the process. + /// + public int PId { get; set; } - /// - /// Memory information for the process. - /// - public MemoryInfo Memory {get; set;} + /// + /// Process type (Browser or Tab or GPU etc). + /// + public string Type { get; set; } - /// - /// Process id of the process. - /// - public int Pid { get; set; } + /// + /// CPU usage of the process. + /// + public CPUUsage Cpu { get; set; } - /// - /// Process type (Browser or Tab or GPU etc). - /// - public string Type { get; set; } + /// + /// Creation time for this process. The time is represented as number of milliseconds since epoch. + /// Since the can be reused after a process dies, it is useful to use both the + /// and the to uniquely identify a process. + /// + public int CreationTime { get; set; } + + /// + /// Memory information for the process. + /// + public MemoryInfo Memory { get; set; } + + /// + /// Whether the process is sandboxed on OS level. + /// + public bool Sandboxed { get; set; } + + /// + /// One of the following values: + /// untrusted | low | medium | high | unknown + /// + public string IntegrityLevel { get; set; } } -} +} \ No newline at end of file diff --git a/ElectronNET.API/Entities/RelaunchOptions.cs b/ElectronNET.API/Entities/RelaunchOptions.cs index 9d816034..5fc8517a 100644 --- a/ElectronNET.API/Entities/RelaunchOptions.cs +++ b/ElectronNET.API/Entities/RelaunchOptions.cs @@ -1,7 +1,7 @@ namespace ElectronNET.API.Entities { /// - /// + /// Controls the behavior of . /// public class RelaunchOptions { @@ -21,4 +21,4 @@ public class RelaunchOptions /// public string ExecPath { get; set; } } -} +} \ No newline at end of file diff --git a/ElectronNET.API/Entities/UserTask.cs b/ElectronNET.API/Entities/UserTask.cs index 985717d2..020910dc 100644 --- a/ElectronNET.API/Entities/UserTask.cs +++ b/ElectronNET.API/Entities/UserTask.cs @@ -52,5 +52,10 @@ public class UserTask /// The title. /// public string Title { get; set; } + + /// + /// The working directory. Default is . + /// + public string WorkingDirectory { get; set; } } -} +} \ No newline at end of file diff --git a/ElectronNET.API/QuitEventArgs.cs b/ElectronNET.API/QuitEventArgs.cs index 582023c9..51335883 100644 --- a/ElectronNET.API/QuitEventArgs.cs +++ b/ElectronNET.API/QuitEventArgs.cs @@ -1,7 +1,7 @@ namespace ElectronNET.API { /// - /// + /// Event arguments for the / event. /// public sealed class QuitEventArgs { @@ -13,4 +13,4 @@ public void PreventDefault() Electron.App.PreventQuit(); } } -} +} \ No newline at end of file diff --git a/ElectronNET.Host/api/app.js b/ElectronNET.Host/api/app.js index 6dd3ab5c..143ae77e 100644 --- a/ElectronNET.Host/api/app.js +++ b/ElectronNET.Host/api/app.js @@ -70,8 +70,8 @@ module.exports = (socket, app) => { socket.on('appRelaunch', (options) => { app.relaunch(options); }); - socket.on('appFocus', () => { - app.focus(); + socket.on('appFocus', (options) => { + app.focus(options); }); socket.on('appHide', () => { app.hide(); @@ -83,6 +83,9 @@ module.exports = (socket, app) => { const path = app.getAppPath(); electronSocket.emit('appGetAppPathCompleted', path); }); + socket.on('appSetAppLogsPath', (path) => { + app.setAppLogsPath(path); + }); socket.on('appGetPath', (name) => { const path = app.getPath(name); electronSocket.emit('appGetPathCompleted', path); @@ -160,16 +163,26 @@ module.exports = (socket, app) => { const success = app.requestSingleInstanceLock(); electronSocket.emit('appRequestSingleInstanceLockCompleted', success); }); + socket.on('appHasSingleInstanceLock', () => { + const hasLock = app.hasSingleInstanceLock(); + electronSocket.emit('appHasSingleInstanceLockCompleted', hasLock); + }); socket.on('appReleaseSingleInstanceLock', () => { app.releaseSingleInstanceLock(); }); - socket.on('appSetUserActivity', (type, userInfo, webpageURL) => { - app.setUserActivity(type, userInfo, webpageURL); + socket.on('appSetUserActivity', (type, userInfo, webpageUrl) => { + app.setUserActivity(type, userInfo, webpageUrl); }); socket.on('appGetCurrentActivityType', () => { const activityType = app.getCurrentActivityType(); electronSocket.emit('appGetCurrentActivityTypeCompleted', activityType); }); + socket.on('appInvalidateCurrentActivity', () => { + app.invalidateCurrentActivity(); + }); + socket.on('appResignCurrentActivity', () => { + app.resignCurrentActivity(); + }); socket.on('appSetAppUserModelId', (id) => { app.setAppUserModelId(id); }); @@ -209,42 +222,14 @@ module.exports = (socket, app) => { const isAccessibilitySupportEnabled = app.isAccessibilitySupportEnabled(); electronSocket.emit('appIsAccessibilitySupportEnabledCompleted', isAccessibilitySupportEnabled); }); - socket.on('appSetAboutPanelOptions', (options) => { - app.setAboutPanelOptions(options); - }); - socket.on('appDockBounce', (type) => { - const id = app.dock.bounce(type); - electronSocket.emit('appDockBounceCompleted', id); - }); - socket.on('appDockCancelBounce', (id) => { - app.dock.cancelBounce(id); + socket.on('appSetAccessibilitySupportEnabled', (enabled) => { + app.setAccessibilitySupportEnabled(enabled); }); - socket.on('appDockDownloadFinished', (filePath) => { - app.dock.downloadFinished(filePath); + socket.on('appShowAboutPanel', () => { + app.showAboutPanel(); }); - socket.on('appDockSetBadge', (text) => { - app.dock.setBadge(text); - }); - socket.on('appDockGetBadge', () => { - const text = app.dock.getBadge(); - electronSocket.emit('appDockGetBadgeCompleted', text); - }); - socket.on('appDockHide', () => { - app.dock.hide(); - }); - socket.on('appDockShow', () => { - app.dock.show(); - }); - socket.on('appDockIsVisible', () => { - const isVisible = app.dock.isVisible(); - electronSocket.emit('appDockIsVisibleCompleted', isVisible); - }); - // TODO: Menü Lösung muss noch implementiert werden - socket.on('appDockSetMenu', (menu) => { - app.dock.setMenu(menu); - }); - socket.on('appDockSetIcon', (image) => { - app.dock.setIcon(image); + socket.on('appSetAboutPanelOptions', (options) => { + app.setAboutPanelOptions(options); }); socket.on('appGetUserAgentFallback', () => { electronSocket.emit('appGetUserAgentFallbackCompleted', app.userAgentFallback); diff --git a/ElectronNET.Host/api/app.js.map b/ElectronNET.Host/api/app.js.map index 19aa5558..308164fa 100644 --- a/ElectronNET.Host/api/app.js.map +++ b/ElectronNET.Host/api/app.js.map @@ -1 +1 @@ -{"version":3,"file":"app.js","sourceRoot":"","sources":["app.ts"],"names":[],"mappings":";AAAA,IAAI,qBAAqB,GAAG,IAAI,EAAE,cAAc,CAAC;AACjD,IAAI,yBAAyB,CAAC;AAC9B,iBAAS,CAAC,MAAuB,EAAE,GAAiB,EAAE,EAAE;IACpD,cAAc,GAAG,MAAM,CAAC;IAExB,+CAA+C;IAC/C,GAAG,CAAC,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC7B,4DAA4D;QAC5D,8DAA8D;QAC9D,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,IAAI,qBAAqB,EAAE;YACxD,GAAG,CAAC,IAAI,EAAE,CAAC;SACd;aAAM,IAAI,yBAAyB,EAAE;YAClC,0BAA0B;YAC1B,SAAS;YACT,qEAAqE;YACrE,kBAAkB;YAClB,cAAc,CAAC,IAAI,CAAC,uBAAuB,GAAG,yBAAyB,CAAC,CAAC;SAC5E;IACL,CAAC,CAAC,CAAC;IAE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G,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,mCAAmC,EAAE,CAAC,OAAO,EAAE,EAAE;QACvD,GAAG,CAAC,8BAA8B,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAChC,GAAG,CAAC,cAAc,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,OAAO,EAAE,EAAE;QAC7C,GAAG,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACtC,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,SAAS,EAAE,EAAE;QAC/C,GAAG,CAAC,iBAAiB,GAAG,SAAS,CAAC;IACtC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"} \ No newline at end of file diff --git a/ElectronNET.Host/api/app.ts b/ElectronNET.Host/api/app.ts index c5710fa2..5e94ce85 100644 --- a/ElectronNET.Host/api/app.ts +++ b/ElectronNET.Host/api/app.ts @@ -84,8 +84,8 @@ export = (socket: SocketIO.Socket, app: Electron.App) => { app.relaunch(options); }); - socket.on('appFocus', () => { - app.focus(); + socket.on('appFocus', (options) => { + app.focus(options); }); socket.on('appHide', () => { @@ -101,6 +101,10 @@ export = (socket: SocketIO.Socket, app: Electron.App) => { electronSocket.emit('appGetAppPathCompleted', path); }); + socket.on('appSetAppLogsPath', (path) => { + app.setAppLogsPath(path); + }); + socket.on('appGetPath', (name) => { const path = app.getPath(name); electronSocket.emit('appGetPathCompleted', path); @@ -200,18 +204,32 @@ export = (socket: SocketIO.Socket, app: Electron.App) => { electronSocket.emit('appRequestSingleInstanceLockCompleted', success); }); + socket.on('appHasSingleInstanceLock', () => { + const hasLock = app.hasSingleInstanceLock(); + + electronSocket.emit('appHasSingleInstanceLockCompleted', hasLock); + }); + socket.on('appReleaseSingleInstanceLock', () => { app.releaseSingleInstanceLock(); }); - socket.on('appSetUserActivity', (type, userInfo, webpageURL) => { - app.setUserActivity(type, userInfo, webpageURL); + socket.on('appSetUserActivity', (type, userInfo, webpageUrl) => { + app.setUserActivity(type, userInfo, webpageUrl); }); socket.on('appGetCurrentActivityType', () => { const activityType = app.getCurrentActivityType(); electronSocket.emit('appGetCurrentActivityTypeCompleted', activityType); }); + + socket.on('appInvalidateCurrentActivity', () => { + app.invalidateCurrentActivity(); + }); + + socket.on('appResignCurrentActivity', () => { + app.resignCurrentActivity(); + }); socket.on('appSetAppUserModelId', (id) => { app.setAppUserModelId(id); @@ -262,53 +280,17 @@ export = (socket: SocketIO.Socket, app: Electron.App) => { electronSocket.emit('appIsAccessibilitySupportEnabledCompleted', isAccessibilitySupportEnabled); }); - socket.on('appSetAboutPanelOptions', (options) => { - app.setAboutPanelOptions(options); - }); - - socket.on('appDockBounce', (type) => { - const id = app.dock.bounce(type); - electronSocket.emit('appDockBounceCompleted', id); - }); - - socket.on('appDockCancelBounce', (id) => { - app.dock.cancelBounce(id); - }); - - socket.on('appDockDownloadFinished', (filePath) => { - app.dock.downloadFinished(filePath); - }); - - socket.on('appDockSetBadge', (text) => { - app.dock.setBadge(text); - }); - - socket.on('appDockGetBadge', () => { - const text = app.dock.getBadge(); - electronSocket.emit('appDockGetBadgeCompleted', text); - }); - - socket.on('appDockHide', () => { - app.dock.hide(); + socket.on('appSetAccessibilitySupportEnabled', (enabled) => { + app.setAccessibilitySupportEnabled(enabled); }); - socket.on('appDockShow', () => { - app.dock.show(); + socket.on('appShowAboutPanel', () => { + app.showAboutPanel(); }); - socket.on('appDockIsVisible', () => { - const isVisible = app.dock.isVisible(); - electronSocket.emit('appDockIsVisibleCompleted', isVisible); - }); - - // TODO: Menü Lösung muss noch implementiert werden - socket.on('appDockSetMenu', (menu) => { - app.dock.setMenu(menu); - }); - - socket.on('appDockSetIcon', (image) => { - app.dock.setIcon(image); - }); + socket.on('appSetAboutPanelOptions', (options) => { + app.setAboutPanelOptions(options); + }); socket.on('appGetUserAgentFallback', () => { electronSocket.emit('appGetUserAgentFallbackCompleted', app.userAgentFallback); diff --git a/ElectronNET.Host/api/dock.js b/ElectronNET.Host/api/dock.js new file mode 100644 index 00000000..3181c9b2 --- /dev/null +++ b/ElectronNET.Host/api/dock.js @@ -0,0 +1,46 @@ +"use strict"; +const electron_1 = require("electron"); +let electronSocket; +module.exports = (socket) => { + electronSocket = socket; + socket.on('dock-bounce', (type) => { + const id = electron_1.app.dock.bounce(type); + electronSocket.emit('dock-bounce-completed', id); + }); + socket.on('dock-cancelBounce', (id) => { + electron_1.app.dock.cancelBounce(id); + }); + socket.on('dock-downloadFinished', (filePath) => { + electron_1.app.dock.downloadFinished(filePath); + }); + socket.on('dock-setBadge', (text) => { + electron_1.app.dock.setBadge(text); + }); + socket.on('dock-getBadge', () => { + const text = electron_1.app.dock.getBadge(); + electronSocket.emit('dock-getBadge-completed', text); + }); + socket.on('dock-hide', () => { + electron_1.app.dock.hide(); + }); + socket.on('dock-show', () => { + electron_1.app.dock.show(); + }); + socket.on('dock-isVisible', () => { + const isVisible = electron_1.app.dock.isVisible(); + electronSocket.emit('dock-isVisible-completed', isVisible); + }); + // TODO: Menu (macOS) still to be implemented + socket.on('dock-setMenu', (menu) => { + electron_1.app.dock.setMenu(menu); + }); + // TODO: Menu (macOS) still to be implemented + socket.on('dock-getMenu', () => { + const menu = electron_1.app.dock.getMenu(); + electronSocket.emit('dock-getMenu-completed', menu); + }); + socket.on('dock-setIcon', (image) => { + electron_1.app.dock.setIcon(image); + }); +}; +//# sourceMappingURL=dock.js.map \ No newline at end of file diff --git a/ElectronNET.Host/api/dock.js.map b/ElectronNET.Host/api/dock.js.map new file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IAAI,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;QACxB,cAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC7B,MAAM,SAAS,GAAG,cAAG,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;QACvC,cAAc,CAAC,IAAI,CAAC,0BAA0B,EAAE,SAAS,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,6CAA6C;IAC7C,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE;QAC/B,cAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,6CAA6C;IAC7C,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;QAC3B,MAAM,IAAI,GAAG,cAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAChC,cAAc,CAAC,IAAI,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE;QAChC,cAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"} \ No newline at end of file diff --git a/ElectronNET.Host/api/dock.ts b/ElectronNET.Host/api/dock.ts new file mode 100644 index 00000000..77659d66 --- /dev/null +++ b/ElectronNET.Host/api/dock.ts @@ -0,0 +1,56 @@ +import { app } from 'electron'; +let electronSocket; + +export = (socket: SocketIO.Socket) => { + electronSocket = socket; + + socket.on('dock-bounce', (type) => { + const id = app.dock.bounce(type); + electronSocket.emit('dock-bounce-completed', id); + }); + + socket.on('dock-cancelBounce', (id) => { + app.dock.cancelBounce(id); + }); + + socket.on('dock-downloadFinished', (filePath) => { + app.dock.downloadFinished(filePath); + }); + + socket.on('dock-setBadge', (text) => { + app.dock.setBadge(text); + }); + + socket.on('dock-getBadge', () => { + const text = app.dock.getBadge(); + electronSocket.emit('dock-getBadge-completed', text); + }); + + socket.on('dock-hide', () => { + app.dock.hide(); + }); + + socket.on('dock-show', () => { + app.dock.show(); + }); + + socket.on('dock-isVisible', () => { + const isVisible = app.dock.isVisible(); + electronSocket.emit('dock-isVisible-completed', isVisible); + }); + + // TODO: Menu (macOS) still to be implemented + socket.on('dock-setMenu', (menu) => { + app.dock.setMenu(menu); + }); + + // TODO: Menu (macOS) still to be implemented + socket.on('dock-getMenu', () => { + const menu = app.dock.getMenu(); + electronSocket.emit('dock-getMenu-completed', menu); + }); + + socket.on('dock-setIcon', (image) => { + app.dock.setIcon(image); + }); +}; \ No newline at end of file diff --git a/ElectronNET.Host/main.js b/ElectronNET.Host/main.js index 7ee0fb7d..d382fdfb 100644 --- a/ElectronNET.Host/main.js +++ b/ElectronNET.Host/main.js @@ -11,6 +11,7 @@ let commandLine, browserView; let powerMonitor; let splashScreen, hostHook; let mainWindowId, nativeTheme; +let dock; let manifestJsonFileName = 'electron.manifest.json'; let watchable = false; @@ -160,6 +161,7 @@ function startSocketApiBridge(port) { delete require.cache[require.resolve('./api/browserView')]; delete require.cache[require.resolve('./api/powerMonitor')]; delete require.cache[require.resolve('./api/nativeTheme')]; + delete require.cache[require.resolve('./api/dock')]; }); global['electronsocket'] = socket; @@ -183,6 +185,7 @@ function startSocketApiBridge(port) { browserView = require('./api/browserView')(socket); powerMonitor = require('./api/powerMonitor')(socket); nativeTheme = require('./api/nativeTheme')(socket); + dock = require('./api/dock')(socket); try { const hostHookScriptFilePath = path.join(__dirname, 'ElectronHostHook', 'index.js'); diff --git a/ElectronNET.WebApp/Controllers/AppSysInformationController.cs b/ElectronNET.WebApp/Controllers/AppSysInformationController.cs index df4b6c84..f184e14c 100644 --- a/ElectronNET.WebApp/Controllers/AppSysInformationController.cs +++ b/ElectronNET.WebApp/Controllers/AppSysInformationController.cs @@ -21,7 +21,7 @@ public IActionResult Index() Electron.IpcMain.On("sys-info", async (args) => { - string homePath = await Electron.App.GetPathAsync(PathName.home); + string homePath = await Electron.App.GetPathAsync(PathName.Home); var mainWindow = Electron.WindowManager.BrowserWindows.First(); Electron.IpcMain.Send(mainWindow, "got-sys-info", homePath); diff --git a/ElectronNET.WebApp/Controllers/PdfController.cs b/ElectronNET.WebApp/Controllers/PdfController.cs index 18a4a1a5..a13fc669 100644 --- a/ElectronNET.WebApp/Controllers/PdfController.cs +++ b/ElectronNET.WebApp/Controllers/PdfController.cs @@ -18,7 +18,7 @@ public IActionResult Index() var saveOptions = new SaveDialogOptions { Title = "Save an PDF-File", - DefaultPath = await Electron.App.GetPathAsync(PathName.documents), + DefaultPath = await Electron.App.GetPathAsync(PathName.Documents), Filters = new FileFilter[] { new FileFilter { Name = "PDF", Extensions = new string[] { "pdf" } } diff --git a/ElectronNET.WebApp/Controllers/ShellController.cs b/ElectronNET.WebApp/Controllers/ShellController.cs index d2c361d8..fa5afe69 100644 --- a/ElectronNET.WebApp/Controllers/ShellController.cs +++ b/ElectronNET.WebApp/Controllers/ShellController.cs @@ -12,7 +12,7 @@ public IActionResult Index() { Electron.IpcMain.On("open-file-manager", async (args) => { - string path = await Electron.App.GetPathAsync(PathName.home); + string path = await Electron.App.GetPathAsync(PathName.Home); await Electron.Shell.ShowItemInFolderAsync(path); });