From f059ba80b40be6b004b6c8fa5efc6b01a265e360 Mon Sep 17 00:00:00 2001 From: Don Alvarez Date: Wed, 15 Nov 2017 16:00:34 -0800 Subject: [PATCH 1/6] Add list of Starter Kits to ReadMe --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 6a1c518..aa53880 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,10 @@ In your default setting we just build the application for the OS you are running The end result should be an electron app under your __/bin/desktop__ folder. +## Starter kits + +There is a React/Typescript/MobX starter kit at https://github.com/yoDon/Electron.NET-React-Typescript-MobX + ### Note > macOS builds on Windows are currently not supported, because the build just hangs, but I'm not sure why. The macOS builds works on Linux/macOS however. From fc5250468e294f03dfeda2225fbd0bb9410c2729 Mon Sep 17 00:00:00 2001 From: danielmarbach Date: Mon, 13 Nov 2017 20:47:31 +0100 Subject: [PATCH 2/6] App cancellation token --- ElectronNET.API/App.cs | 669 +++++++++++++++++++++++++---------------- 1 file changed, 416 insertions(+), 253 deletions(-) diff --git a/ElectronNET.API/App.cs b/ElectronNET.API/App.cs index 68463e3..7a66589 100644 --- a/ElectronNET.API/App.cs +++ b/ElectronNET.API/App.cs @@ -464,40 +464,49 @@ namespace ElectronNET.API /// The current application directory. /// /// - public async Task GetAppPathAsync() + public async Task GetAppPathAsync(CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appGetAppPathCompleted", (path) => + using(cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appGetAppPathCompleted"); - taskCompletionSource.SetResult(path.ToString()); - }); + BridgeConnector.Socket.On("appGetAppPathCompleted", (path) => + { + BridgeConnector.Socket.Off("appGetAppPathCompleted"); + taskCompletionSource.SetResult(path.ToString()); + }); - BridgeConnector.Socket.Emit("appGetAppPath"); + BridgeConnector.Socket.Emit("appGetAppPath"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// /// You can request the following paths by the name. /// - /// /// A path to a special directory or file associated with name. - public async Task GetPathAsync(PathName pathName) + public async Task GetPathAsync(PathName pathName, CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); + using(cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) + { + BridgeConnector.Socket.On("appGetPathCompleted", (path) => + { + BridgeConnector.Socket.Off("appGetPathCompleted"); - BridgeConnector.Socket.On("appGetPathCompleted", (path) => - { - BridgeConnector.Socket.Off("appGetPathCompleted"); + taskCompletionSource.SetResult(path.ToString()); + }); - taskCompletionSource.SetResult(path.ToString()); - }); + BridgeConnector.Socket.Emit("appGetPath", pathName.ToString()); - BridgeConnector.Socket.Emit("appGetPath", pathName.ToString()); - - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } @@ -522,19 +531,24 @@ namespace ElectronNET.API /// the version of the current bundle or executable is returned. /// /// - public async Task GetVersionAsync() + public async Task GetVersionAsync(CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appGetVersionCompleted", (version) => + using(cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appGetVersionCompleted"); - taskCompletionSource.SetResult(version.ToString()); - }); + BridgeConnector.Socket.On("appGetVersionCompleted", (version) => + { + BridgeConnector.Socket.Off("appGetVersionCompleted"); + taskCompletionSource.SetResult(version.ToString()); + }); - BridgeConnector.Socket.Emit("appGetVersion"); + BridgeConnector.Socket.Emit("appGetVersion"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -544,19 +558,24 @@ namespace ElectronNET.API /// name by Electron. /// /// The current application’s name, which is the name in the application’s package.json file. - public async Task GetNameAsync() + public async Task GetNameAsync(CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appGetNameCompleted", (name) => + using(cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appGetNameCompleted"); - taskCompletionSource.SetResult(name.ToString()); - }); + BridgeConnector.Socket.On("appGetNameCompleted", (name) => + { + BridgeConnector.Socket.Off("appGetNameCompleted"); + taskCompletionSource.SetResult(name.ToString()); + }); - BridgeConnector.Socket.Emit("appGetName"); + BridgeConnector.Socket.Emit("appGetName"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -574,19 +593,24 @@ namespace ElectronNET.API /// folder.Note: On Windows you have to call it after the ready events gets emitted. /// /// - public async Task GetLocaleAsync() + public async Task GetLocaleAsync(CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appGetLocaleCompleted", (locale) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appGetLocaleCompleted"); - taskCompletionSource.SetResult(locale.ToString()); - }); + BridgeConnector.Socket.On("appGetLocaleCompleted", (local) => + { + BridgeConnector.Socket.Off("appGetLocaleCompleted"); + taskCompletionSource.SetResult(local.ToString()); + }); - BridgeConnector.Socket.Emit("appGetLocale"); + BridgeConnector.Socket.Emit("appGetLocale"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -625,20 +649,26 @@ namespace ElectronNET.API /// The name of your protocol, without ://. /// 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) + public async Task SetAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appSetAsDefaultProtocolClientCompleted", (success) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appSetAsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); - }); + BridgeConnector.Socket.On("appSetAsDefaultProtocolClientCompleted", (success) => + { + BridgeConnector.Socket.Off("appSetAsDefaultProtocolClientCompleted"); + taskCompletionSource.SetResult((bool)success); + }); - BridgeConnector.Socket.Emit("appSetAsDefaultProtocolClient", protocol); + BridgeConnector.Socket.Emit("appSetAsDefaultProtocolClient", protocol); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -659,20 +689,26 @@ namespace ElectronNET.API /// If you want your app to handle electron:// links, /// call this method with electron as the parameter. /// Defaults to process.execPath + /// The cancellation token. /// Whether the call succeeded. - public async Task SetAsDefaultProtocolClientAsync(string protocol, string path) + public async Task SetAsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appSetAsDefaultProtocolClientCompleted", (success) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appSetAsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); - }); + BridgeConnector.Socket.On("appSetAsDefaultProtocolClientCompleted", (success) => + { + BridgeConnector.Socket.Off("appSetAsDefaultProtocolClientCompleted"); + taskCompletionSource.SetResult((bool)success); + }); - BridgeConnector.Socket.Emit("appSetAsDefaultProtocolClient", protocol, path); + BridgeConnector.Socket.Emit("appSetAsDefaultProtocolClient", protocol, path); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -694,20 +730,26 @@ namespace ElectronNET.API /// call this method with electron as the parameter. /// Defaults to process.execPath /// Defaults to an empty array + /// The cancellation token. /// Whether the call succeeded. - public async Task SetAsDefaultProtocolClientAsync(string protocol, string path, string[] args) + public async Task SetAsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appSetAsDefaultProtocolClientCompleted", (success) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appSetAsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); - }); + BridgeConnector.Socket.On("appSetAsDefaultProtocolClientCompleted", (success) => + { + BridgeConnector.Socket.Off("appSetAsDefaultProtocolClientCompleted"); + taskCompletionSource.SetResult((bool)success); + }); - BridgeConnector.Socket.Emit("appSetAsDefaultProtocolClient", protocol, path, args); + BridgeConnector.Socket.Emit("appSetAsDefaultProtocolClient", protocol, path, args); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -715,20 +757,26 @@ namespace ElectronNET.API /// 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) + public async Task RemoveAsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appRemoveAsDefaultProtocolClientCompleted", (success) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appRemoveAsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); - }); + BridgeConnector.Socket.On("appRemoveAsDefaultProtocolClientCompleted", (success) => + { + BridgeConnector.Socket.Off("appRemoveAsDefaultProtocolClientCompleted"); + taskCompletionSource.SetResult((bool)success); + }); - BridgeConnector.Socket.Emit("appRemoveAsDefaultProtocolClient", protocol); + BridgeConnector.Socket.Emit("appRemoveAsDefaultProtocolClient", protocol); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -737,20 +785,26 @@ namespace ElectronNET.API /// /// 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) + public async Task RemoveAsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appRemoveAsDefaultProtocolClientCompleted", (success) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appRemoveAsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); - }); + BridgeConnector.Socket.On("appRemoveAsDefaultProtocolClientCompleted", (success) => + { + BridgeConnector.Socket.Off("appRemoveAsDefaultProtocolClientCompleted"); + taskCompletionSource.SetResult((bool)success); + }); - BridgeConnector.Socket.Emit("appRemoveAsDefaultProtocolClient", protocol, path); + BridgeConnector.Socket.Emit("appRemoveAsDefaultProtocolClient", protocol, path); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -760,20 +814,26 @@ namespace ElectronNET.API /// 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) - { + public async Task RemoveAsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default(CancellationToken)) + { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appRemoveAsDefaultProtocolClientCompleted", (success) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appRemoveAsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); - }); + BridgeConnector.Socket.On("appRemoveAsDefaultProtocolClientCompleted", (success) => + { + BridgeConnector.Socket.Off("appRemoveAsDefaultProtocolClientCompleted"); + taskCompletionSource.SetResult((bool)success); + }); - BridgeConnector.Socket.Emit("appRemoveAsDefaultProtocolClient", protocol, path, args); + BridgeConnector.Socket.Emit("appRemoveAsDefaultProtocolClient", protocol, path, args); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -786,20 +846,26 @@ namespace ElectronNET.API /// the Windows Registry and LSCopyDefaultHandlerForURLScheme internally. /// /// The name of your protocol, without ://. + /// The cancellation token. /// Returns Boolean - public async Task IsDefaultProtocolClientAsync(string protocol) + public async Task IsDefaultProtocolClientAsync(string protocol, CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appIsDefaultProtocolClientCompleted", (success) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appIsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); - }); + BridgeConnector.Socket.On("appIsDefaultProtocolClientCompleted", (success) => + { + BridgeConnector.Socket.Off("appIsDefaultProtocolClientCompleted"); + taskCompletionSource.SetResult((bool)success); + }); - BridgeConnector.Socket.Emit("appIsDefaultProtocolClient", protocol); + BridgeConnector.Socket.Emit("appIsDefaultProtocolClient", protocol); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -813,20 +879,26 @@ namespace ElectronNET.API /// /// The name of your protocol, without ://. /// Defaults to process.execPath. + /// The cancellation token. /// Returns Boolean - public async Task IsDefaultProtocolClientAsync(string protocol, string path) + public async Task IsDefaultProtocolClientAsync(string protocol, string path, CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appIsDefaultProtocolClientCompleted", (success) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appIsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); - }); + BridgeConnector.Socket.On("appIsDefaultProtocolClientCompleted", (success) => + { + BridgeConnector.Socket.Off("appIsDefaultProtocolClientCompleted"); + taskCompletionSource.SetResult((bool)success); + }); - BridgeConnector.Socket.Emit("appIsDefaultProtocolClient", protocol, path); + BridgeConnector.Socket.Emit("appIsDefaultProtocolClient", protocol, path); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -841,20 +913,26 @@ namespace ElectronNET.API /// 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) + public async Task IsDefaultProtocolClientAsync(string protocol, string path, string[] args, CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appIsDefaultProtocolClientCompleted", (success) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appIsDefaultProtocolClientCompleted"); - taskCompletionSource.SetResult((bool)success); - }); + BridgeConnector.Socket.On("appIsDefaultProtocolClientCompleted", (success) => + { + BridgeConnector.Socket.Off("appIsDefaultProtocolClientCompleted"); + taskCompletionSource.SetResult((bool)success); + }); - BridgeConnector.Socket.Emit("appIsDefaultProtocolClient", protocol, path, args); + BridgeConnector.Socket.Emit("appIsDefaultProtocolClient", protocol, path, args); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -863,39 +941,50 @@ namespace ElectronNET.API /// app.setJumpList(categories) instead. /// /// Array of Task objects. + /// The cancellation token. /// Whether the call succeeded. - public async Task SetUserTasksAsync(UserTask[] userTasks) + public async Task SetUserTasksAsync(UserTask[] userTasks, CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appSetUserTasksCompleted", (success) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appSetUserTasksCompleted"); - taskCompletionSource.SetResult((bool)success); - }); + BridgeConnector.Socket.On("appSetUserTasksCompleted", (success) => + { + BridgeConnector.Socket.Off("appSetUserTasksCompleted"); + taskCompletionSource.SetResult((bool)success); + }); - BridgeConnector.Socket.Emit("appSetUserTasks", JObject.FromObject(userTasks, _jsonSerializer)); + BridgeConnector.Socket.Emit("appSetUserTasks", JObject.FromObject(userTasks, _jsonSerializer)); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// /// Jump List settings for the application. /// /// - public async Task GetJumpListSettingsAsync() + public async Task GetJumpListSettingsAsync(CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appGetJumpListSettingsCompleted", (success) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appGetJumpListSettingsCompleted"); - taskCompletionSource.SetResult(JObject.Parse(success.ToString()).ToObject()); - }); + BridgeConnector.Socket.On("appGetJumpListSettingsCompleted", (jumplistSettings) => + { + BridgeConnector.Socket.Off("appGetJumpListSettingsCompleted"); + taskCompletionSource.SetResult(JObject.Parse(jumplistSettings.ToString()).ToObject()); + }); - BridgeConnector.Socket.Emit("appGetJumpListSettings"); + BridgeConnector.Socket.Emit("appGetJumpListSettings"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -939,32 +1028,38 @@ namespace ElectronNET.API /// /// 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 MakeSingleInstanceAsync(Action newInstanceOpened) + public async Task MakeSingleInstanceAsync(Action newInstanceOpened, CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appMakeSingleInstanceCompleted", (success) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appMakeSingleInstanceCompleted"); - taskCompletionSource.SetResult((bool)success); - }); + BridgeConnector.Socket.On("appMakeSingleInstanceCompleted", (success) => + { + BridgeConnector.Socket.Off("appMakeSingleInstanceCompleted"); + taskCompletionSource.SetResult((bool)success); + }); - BridgeConnector.Socket.Off("newInstanceOpened"); - BridgeConnector.Socket.On("newInstanceOpened", (result) => - { - JArray results = (JArray)result; - string[] args = results.First.ToObject(); - string workdirectory = results.Last.ToObject(); + BridgeConnector.Socket.Off("newInstanceOpened"); + BridgeConnector.Socket.On("newInstanceOpened", (result) => + { + JArray results = (JArray)result; + string[] args = results.First.ToObject(); + string workdirectory = results.Last.ToObject(); - newInstanceOpened(args, workdirectory); - }); + newInstanceOpened(args, workdirectory); + }); - BridgeConnector.Socket.Emit("appMakeSingleInstance"); + BridgeConnector.Socket.Emit("appMakeSingleInstance"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -1003,19 +1098,24 @@ namespace ElectronNET.API /// The type of the currently running activity. /// /// - public async Task GetCurrentActivityTypeAsync() + public async Task GetCurrentActivityTypeAsync(CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appGetCurrentActivityTypeCompleted", (activityType) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appGetCurrentActivityTypeCompleted"); - taskCompletionSource.SetResult(activityType.ToString()); - }); + BridgeConnector.Socket.On("appGetCurrentActivityTypeCompleted", (activityType) => + { + BridgeConnector.Socket.Off("appGetCurrentActivityTypeCompleted"); + taskCompletionSource.SetResult(activityType.ToString()); + }); - BridgeConnector.Socket.Emit("appGetCurrentActivityType"); + BridgeConnector.Socket.Emit("appGetCurrentActivityType"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -1033,62 +1133,78 @@ namespace ElectronNET.API /// success while any other value indicates failure according to chromium net_error_list. /// /// + /// The cancellation token. /// Result of import. Value of 0 indicates success. - public async Task ImportCertificateAsync(ImportCertificateOptions options) + public async Task ImportCertificateAsync(ImportCertificateOptions options, CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appImportCertificateCompleted", (result) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appImportCertificateCompleted"); - taskCompletionSource.SetResult((int)result); - }); + BridgeConnector.Socket.On("appImportCertificateCompleted", (result) => + { + BridgeConnector.Socket.Off("appImportCertificateCompleted"); + taskCompletionSource.SetResult((int)result); + }); - BridgeConnector.Socket.Emit("appImportCertificate", JObject.FromObject(options, _jsonSerializer)); + BridgeConnector.Socket.Emit("appImportCertificate", JObject.FromObject(options, _jsonSerializer)); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// /// Memory and cpu usage statistics of all the processes associated with the app. /// /// - public async Task GetAppMetricsAsync() + public async Task GetAppMetricsAsync(CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appGetAppMetricsCompleted", (result) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appGetAppMetricsCompleted"); - var processMetrics = ((JArray)result).ToObject(); + BridgeConnector.Socket.On("appGetAppMetricsCompleted", (result) => + { + BridgeConnector.Socket.Off("appGetAppMetricsCompleted"); + var processMetrics = ((JArray)result).ToObject(); - taskCompletionSource.SetResult(processMetrics); - }); + taskCompletionSource.SetResult(processMetrics); + }); - BridgeConnector.Socket.Emit("appGetAppMetrics"); + BridgeConnector.Socket.Emit("appGetAppMetrics"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// /// The Graphics Feature Status from chrome://gpu/. /// /// - public async Task GetGpuFeatureStatusAsync() + public async Task GetGpuFeatureStatusAsync(CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appGetGpuFeatureStatusCompleted", (result) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appGetGpuFeatureStatusCompleted"); - var gpuFeatureStatus = ((JObject)result).ToObject(); + BridgeConnector.Socket.On("appGetGpuFeatureStatusCompleted", (result) => + { + BridgeConnector.Socket.Off("appGetGpuFeatureStatusCompleted"); + var gpuFeatureStatus = ((JObject)result).ToObject(); - taskCompletionSource.SetResult(gpuFeatureStatus); - }); + taskCompletionSource.SetResult(gpuFeatureStatus); + }); - BridgeConnector.Socket.Emit("appGetGpuFeatureStatus"); + BridgeConnector.Socket.Emit("appGetGpuFeatureStatus"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -1099,57 +1215,72 @@ namespace ElectronNET.API /// /// /// Whether the call succeeded. - public async Task SetBadgeCountAsync(int count) + public async Task SetBadgeCountAsync(int count, CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appSetBadgeCountCompleted", (success) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appSetBadgeCountCompleted"); - taskCompletionSource.SetResult((bool)success); - }); + BridgeConnector.Socket.On("appSetBadgeCountCompleted", (success) => + { + BridgeConnector.Socket.Off("appSetBadgeCountCompleted"); + taskCompletionSource.SetResult((bool)success); + }); - BridgeConnector.Socket.Emit("appSetBadgeCount", count); + BridgeConnector.Socket.Emit("appSetBadgeCount"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// /// The current value displayed in the counter badge. /// /// - public async Task GetBadgeCountAsync() + public async Task GetBadgeCountAsync(CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appGetBadgeCountCompleted", (count) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appGetBadgeCountCompleted"); - taskCompletionSource.SetResult((int)count); - }); + BridgeConnector.Socket.On("appGetBadgeCountCompleted", (count) => + { + BridgeConnector.Socket.Off("appGetBadgeCountCompleted"); + taskCompletionSource.SetResult((int)count); + }); - BridgeConnector.Socket.Emit("appGetBadgeCount"); + BridgeConnector.Socket.Emit("appGetBadgeCount"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// /// Whether the current desktop environment is Unity launcher. /// /// - public async Task IsUnityRunningAsync() + public async Task IsUnityRunningAsync(CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appIsUnityRunningCompleted", (isUnityRunning) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appIsUnityRunningCompleted"); - taskCompletionSource.SetResult((bool)isUnityRunning); - }); + BridgeConnector.Socket.On("appIsUnityRunningCompleted", (isUnityRunning) => + { + BridgeConnector.Socket.Off("appIsUnityRunningCompleted"); + taskCompletionSource.SetResult((bool)isUnityRunning); + }); - BridgeConnector.Socket.Emit("appIsUnityRunning"); + BridgeConnector.Socket.Emit("appIsUnityRunning"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -1158,19 +1289,24 @@ namespace ElectronNET.API /// API has no effect on MAS builds. /// /// - public async Task GetLoginItemSettingsAsync() + public async Task GetLoginItemSettingsAsync(CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appGetLoginItemSettingsCompleted", (loginItemSettings) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appGetLoginItemSettingsCompleted"); - taskCompletionSource.SetResult((LoginItemSettings)loginItemSettings); - }); + BridgeConnector.Socket.On("appGetLoginItemSettingsCompleted", (loginItemSettings) => + { + BridgeConnector.Socket.Off("appGetLoginItemSettingsCompleted"); + taskCompletionSource.SetResult((LoginItemSettings)loginItemSettings); + }); - BridgeConnector.Socket.Emit("appGetLoginItemSettings"); + BridgeConnector.Socket.Emit("appGetLoginItemSettings"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -1179,20 +1315,26 @@ namespace ElectronNET.API /// API has no effect on MAS builds. /// /// + /// The cancellation token. /// - public async Task GetLoginItemSettingsAsync(LoginItemSettingsOptions options) + public async Task GetLoginItemSettingsAsync(LoginItemSettingsOptions options, CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appGetLoginItemSettingsCompleted", (loginItemSettings) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appGetLoginItemSettingsCompleted"); - taskCompletionSource.SetResult((LoginItemSettings)loginItemSettings); - }); + BridgeConnector.Socket.On("appGetLoginItemSettingsCompleted", (loginItemSettings) => + { + BridgeConnector.Socket.Off("appGetLoginItemSettingsCompleted"); + taskCompletionSource.SetResult((LoginItemSettings)loginItemSettings); + }); - BridgeConnector.Socket.Emit("appGetLoginItemSettings", JObject.FromObject(options, _jsonSerializer)); + BridgeConnector.Socket.Emit("appGetLoginItemSettings", JObject.FromObject(options, _jsonSerializer)); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -1212,19 +1354,24 @@ namespace ElectronNET.API /// See https://www.chromium.org/developers/design-documents/accessibility for more details. /// /// true if Chrome’s accessibility support is enabled, false otherwise. - public async Task IsAccessibilitySupportEnabledAsync() + public async Task IsAccessibilitySupportEnabledAsync(CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appIsAccessibilitySupportEnabledCompleted", (isAccessibilitySupportEnabled) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appIsAccessibilitySupportEnabledCompleted"); - taskCompletionSource.SetResult((bool)isAccessibilitySupportEnabled); - }); + BridgeConnector.Socket.On("appIsAccessibilitySupportEnabledCompleted", (isAccessibilitySupportEnabled) => + { + BridgeConnector.Socket.Off("appIsAccessibilitySupportEnabledCompleted"); + taskCompletionSource.SetResult((bool)isAccessibilitySupportEnabled); + }); - BridgeConnector.Socket.Emit("appIsAccessibilitySupportEnabled"); + BridgeConnector.Socket.Emit("appIsAccessibilitySupportEnabled"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -1285,20 +1432,26 @@ namespace ElectronNET.API /// either the application becomes active or the request is canceled. /// /// + /// /// - public async Task DockBounceAsync(DockBounceType type) + public async Task DockBounceAsync(DockBounceType type, CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appDockBounceCompleted", (id) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appDockBounceCompleted"); - taskCompletionSource.SetResult((int)id); - }); + BridgeConnector.Socket.On("appDockBounceCompleted", (id) => + { + BridgeConnector.Socket.Off("appDockBounceCompleted"); + taskCompletionSource.SetResult((int)id); + }); - BridgeConnector.Socket.Emit("appDockBounce", type.ToString()); + BridgeConnector.Socket.Emit("appDockBounce", type.ToString()); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -1332,19 +1485,24 @@ namespace ElectronNET.API /// Gets the string to be displayed in the dock’s badging area. /// /// - public async Task DockGetBadgeAsync() + public async Task DockGetBadgeAsync(CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appDockGetBadgeCompleted", (text) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appDockGetBadgeCompleted"); - taskCompletionSource.SetResult((string)text); - }); + BridgeConnector.Socket.On("appDockGetBadgeCompleted", (text) => + { + BridgeConnector.Socket.Off("appDockGetBadgeCompleted"); + taskCompletionSource.SetResult((string)text); + }); - BridgeConnector.Socket.Emit("appDockGetBadge"); + BridgeConnector.Socket.Emit("appDockGetBadge"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } /// @@ -1368,19 +1526,24 @@ namespace ElectronNET.API /// so this method might not return true immediately after that call. /// /// - public async Task DockIsVisibleAsync() + public async Task DockIsVisibleAsync(CancellationToken cancellationToken = default(CancellationToken)) { + cancellationToken.ThrowIfCancellationRequested(); + var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("appDockIsVisibleCompleted", (isVisible) => + using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled())) { - BridgeConnector.Socket.Off("appDockIsVisibleCompleted"); - taskCompletionSource.SetResult((bool)isVisible); - }); + BridgeConnector.Socket.On("appDockIsVisibleCompleted", (isVisible) => + { + BridgeConnector.Socket.Off("appDockIsVisibleCompleted"); + taskCompletionSource.SetResult((bool)isVisible); + }); - BridgeConnector.Socket.Emit("appDockIsVisible"); + BridgeConnector.Socket.Emit("appDockIsVisible"); - return await taskCompletionSource.Task; + return await taskCompletionSource.Task + .ConfigureAwait(false); + } } // TODO: Menu lösung für macOS muss gemacht werden und imeplementiert From 8315153064a686d17557c220100b3fa96cf130a2 Mon Sep 17 00:00:00 2001 From: Don Alvarez Date: Fri, 24 Nov 2017 16:26:14 -0800 Subject: [PATCH 3/6] Add link in Readme to underlying Electron issue preventing macOS builds from being produced on Windows machines --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aa53880..9a5d9fc 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ The end result should be an electron app under your __/bin/desktop__ folder. There is a React/Typescript/MobX starter kit at https://github.com/yoDon/Electron.NET-React-Typescript-MobX ### Note -> macOS builds on Windows are currently not supported, because the build just hangs, but I'm not sure why. The macOS builds works on Linux/macOS however. +> macOS builds can't be created on Windows machines because they require symlinks that aren't supported on Windows (per [this Electron issue](https://github.com/electron-userland/electron-packager/issues/71)). macOS builds can be produced on either Linux or macOS machines. # Working with this Repo From 2461bcbd7268bdb0fdbaf49a1bfa8f6287eb5de0 Mon Sep 17 00:00:00 2001 From: Wolfgang Ziegler Date: Thu, 7 Dec 2017 09:05:06 +0100 Subject: [PATCH 4/6] Update README.md Fixed typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a1c518..0cd471a 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Travis-CI (Win/macOS/Linux): [![Build Status](https://travis-ci.org/ElectronNET/ Build cross platform desktop apps with .NET Core 2.0 and ASP.NET NET Core. -Electron.NET is a __wrapper__ around a "normal" Electron application with a embedded ASP.NET Core application. Via our Electron.NET IPC bridge we can invoke Electron APIs from .NET. +Electron.NET is a __wrapper__ around a "normal" Electron application with an embedded ASP.NET Core application. Via our Electron.NET IPC bridge we can invoke Electron APIs from .NET. The CLI extensions hosts our toolset to build and start Electron.NET applications. From 331ebb3d7f0769c636d210c1935b0e3dc77a7923 Mon Sep 17 00:00:00 2001 From: Gregor Biswanger Date: Tue, 23 Jan 2018 23:41:15 +0100 Subject: [PATCH 5/6] update to the new electron version --- ElectronNET.Host/package-lock.json | 123 +++++++----------- ElectronNET.Host/package.json | 2 +- .../Controllers/ShortcutsController.cs | 2 +- 3 files changed, 52 insertions(+), 75 deletions(-) diff --git a/ElectronNET.Host/package-lock.json b/ElectronNET.Host/package-lock.json index 8803dfc..add5ea6 100644 --- a/ElectronNET.Host/package-lock.json +++ b/ElectronNET.Host/package-lock.json @@ -10,7 +10,7 @@ "integrity": "sha512-MOCVyzIwkBEloreoCVrTV108vSf8fFIJPsGruLCoAoBZdxtnJUqKA4lNonf/2u1twSjAspPEfmEheC+TLm/cMw==", "dev": true, "requires": { - "electron": "1.7.8" + "electron": "1.7.11" } }, "@types/node": { @@ -47,14 +47,14 @@ "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=" }, "ajv": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.2.3.tgz", - "integrity": "sha1-wG9Zh3jETGsWGrr+NGa4GtGBTtI=", + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", "requires": { "co": "4.6.0", "fast-deep-equal": "1.0.0", - "json-schema-traverse": "0.3.1", - "json-stable-stringify": "1.0.1" + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" } }, "ansi-regex": { @@ -348,13 +348,13 @@ } }, "electron": { - "version": "1.7.8", - "resolved": "https://registry.npmjs.org/electron/-/electron-1.7.8.tgz", - "integrity": "sha1-J7eRpolRcafVKZG5lELNvRCjU50=", + "version": "1.7.11", + "resolved": "https://registry.npmjs.org/electron/-/electron-1.7.11.tgz", + "integrity": "sha1-mTtqp54OeafPzDafTIE/vZoLCNk=", "requires": { "@types/node": "7.0.43", "electron-download": "3.3.0", - "extract-zip": "1.6.5" + "extract-zip": "1.6.6" } }, "electron-download": { @@ -368,8 +368,8 @@ "minimist": "1.2.0", "nugget": "2.0.1", "path-exists": "2.1.0", - "rc": "1.2.1", - "semver": "5.4.1", + "rc": "1.2.4", + "semver": "5.5.0", "sumchecker": "1.3.1" } }, @@ -426,9 +426,9 @@ } }, "es6-promise": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.1.tgz", - "integrity": "sha512-OaU1hHjgJf+b0NzsxCg7NdIYERD6Hy/PEmFLTjw+b65scuisG3Kt4QoTvJ66BBkPZ581gr0kpoVzKnxniM8nng==" + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz", + "integrity": "sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ==" }, "extend": { "version": "3.0.1", @@ -436,29 +436,14 @@ "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" }, "extract-zip": { - "version": "1.6.5", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.5.tgz", - "integrity": "sha1-maBnNbbqIOqbcF13ms/8yHz/BEA=", + "version": "1.6.6", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.6.tgz", + "integrity": "sha1-EpDt6NINCHK0Kf0/NRyhKOxe+Fw=", "requires": { "concat-stream": "1.6.0", - "debug": "2.2.0", + "debug": "2.6.9", "mkdirp": "0.5.0", "yauzl": "2.4.1" - }, - "dependencies": { - "debug": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", - "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", - "requires": { - "ms": "0.7.1" - } - }, - "ms": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", - "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=" - } } }, "extsprintf": { @@ -471,6 +456,11 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=" }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, "fd-slicer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", @@ -561,7 +551,7 @@ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", "requires": { - "ajv": "5.2.3", + "ajv": "5.5.2", "har-schema": "2.0.0" } }, @@ -593,7 +583,7 @@ "boom": "4.3.1", "cryptiles": "3.1.2", "hoek": "4.2.0", - "sntp": "2.0.2" + "sntp": "2.1.0" } }, "hoek": { @@ -649,9 +639,9 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "ini": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", - "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=" + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" }, "is-arrayish": { "version": "0.2.1", @@ -718,14 +708,6 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" }, - "json-stable-stringify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", - "requires": { - "jsonify": "0.0.0" - } - }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -739,11 +721,6 @@ "graceful-fs": "4.1.11" } }, - "jsonify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" - }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -864,7 +841,7 @@ "requires": { "hosted-git-info": "2.5.0", "is-builtin-module": "1.0.0", - "semver": "5.4.1", + "semver": "5.5.0", "validate-npm-package-license": "3.0.1" } }, @@ -1024,12 +1001,12 @@ "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" }, "rc": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz", - "integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.4.tgz", + "integrity": "sha1-oPYGyq4qO4YrvQ74VILAElsxX6M=", "requires": { "deep-extend": "0.4.2", - "ini": "1.3.4", + "ini": "1.3.5", "minimist": "1.2.0", "strip-json-comments": "2.0.1" } @@ -1107,7 +1084,7 @@ "stringstream": "0.0.5", "tough-cookie": "2.3.3", "tunnel-agent": "0.6.0", - "uuid": "3.1.0" + "uuid": "3.2.1" } }, "rimraf": { @@ -1124,9 +1101,9 @@ "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, "semver": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==" + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==" }, "signal-exit": { "version": "3.0.2", @@ -1142,9 +1119,9 @@ } }, "sntp": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.0.2.tgz", - "integrity": "sha1-UGQRDwr4X3z9t9a2ekACjOUrSys=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", "requires": { "hoek": "4.2.0" } @@ -1243,11 +1220,6 @@ "tweetnacl": "0.14.5" } }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, "string-width": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", @@ -1258,6 +1230,11 @@ "strip-ansi": "3.0.1" } }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", @@ -1298,7 +1275,7 @@ "integrity": "sha1-ebs7RFbdBPGOvbwNcDodHa7FEF0=", "requires": { "debug": "2.6.9", - "es6-promise": "4.1.1" + "es6-promise": "4.2.4" } }, "throttleit": { @@ -1363,9 +1340,9 @@ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "uuid": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", + "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==" }, "uws": { "version": "0.14.5", diff --git a/ElectronNET.Host/package.json b/ElectronNET.Host/package.json index d9f8a56..19a60dc 100644 --- a/ElectronNET.Host/package.json +++ b/ElectronNET.Host/package.json @@ -11,7 +11,7 @@ "license": "ISC", "dependencies": { "detect-port": "^1.2.1", - "electron": "^1.7.8", + "electron": "^1.7.11", "socket.io": "^2.0.3" }, "devDependencies": { diff --git a/ElectronNET.WebApp/Controllers/ShortcutsController.cs b/ElectronNET.WebApp/Controllers/ShortcutsController.cs index e96eee5..246e229 100644 --- a/ElectronNET.WebApp/Controllers/ShortcutsController.cs +++ b/ElectronNET.WebApp/Controllers/ShortcutsController.cs @@ -22,7 +22,7 @@ namespace ElectronNET.WebApp.Controllers await Electron.Dialog.ShowMessageBoxAsync(options); }); - Electron.App.WillQuit += (args) => Task.Run(() => Electron.GlobalShortcut.UnregisterAll()); + Electron.App.WillQuit += () => Task.Run(() => Electron.GlobalShortcut.UnregisterAll()); } return View(); From e4d03eed39bcdf9b071ffaafba11e081be090548 Mon Sep 17 00:00:00 2001 From: Robert Muehsig Date: Wed, 24 Jan 2018 22:44:27 +0100 Subject: [PATCH 6/6] build fix --- ElectronNET.WebApp/Controllers/ShortcutsController.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ElectronNET.WebApp/Controllers/ShortcutsController.cs b/ElectronNET.WebApp/Controllers/ShortcutsController.cs index 246e229..6580299 100644 --- a/ElectronNET.WebApp/Controllers/ShortcutsController.cs +++ b/ElectronNET.WebApp/Controllers/ShortcutsController.cs @@ -21,8 +21,7 @@ namespace ElectronNET.WebApp.Controllers await Electron.Dialog.ShowMessageBoxAsync(options); }); - - Electron.App.WillQuit += () => Task.Run(() => Electron.GlobalShortcut.UnregisterAll()); + Electron.App.WillQuit += arg => Task.Run(() => Electron.GlobalShortcut.UnregisterAll()); } return View();