mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-04 05:34:51 +00:00
Compare commits
24 Commits
0.1.0-pre.
...
0.1.0-pre.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1e7b84ec6 | ||
|
|
9bb7dcfa62 | ||
|
|
c0e711940d | ||
|
|
d03458094b | ||
|
|
14962e1983 | ||
|
|
d79b73e960 | ||
|
|
21ae89bc70 | ||
|
|
7927a95cb8 | ||
|
|
758e6a41e3 | ||
|
|
61421ddd66 | ||
|
|
98d085f112 | ||
|
|
cf0b12ed0a | ||
|
|
4c3065c64b | ||
|
|
2a6d2117e9 | ||
|
|
93f457dd0f | ||
|
|
6001a3c481 | ||
|
|
4671b9b32a | ||
|
|
de7f98136e | ||
|
|
87668f5606 | ||
|
|
ea688026d0 | ||
|
|
b6b9292478 | ||
|
|
408f83e401 | ||
|
|
689a002dc2 | ||
|
|
f919289628 |
@@ -4,9 +4,14 @@
|
||||
|
||||
- Updated `PrintToPDFOptions` to also allow specifying the `PageSize` with an object (#769)
|
||||
- Updated splashscreen image to have 0 margin (#622)
|
||||
- Updated the IPC API w.r.t. naming and consistency (#905) @agracio
|
||||
- Fixed creation of windows with `contextIsolation` enabled (#906) @NimbusFox
|
||||
- Fixed single instance behavior using the `ElectronSingleInstance` property (#901)
|
||||
- Fixed potential race conditions (#908) @softworkz
|
||||
- Added option to use `ElectronSplashScreen` with an HTML file (#799)
|
||||
- Added option to provide floating point value as aspect ratios with `SetAspectRatio` (#793)
|
||||
- Added `TitleBarOverlay` property to `BrowserWindowOptions` (#909)
|
||||
- Added `RoundedCorners` property to `BrowserWindowOptions`
|
||||
|
||||
# 0.0.18
|
||||
|
||||
|
||||
177
src/ElectronNET.API/API/ApiBase.cs
Normal file
177
src/ElectronNET.API/API/ApiBase.cs
Normal file
@@ -0,0 +1,177 @@
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.Common;
|
||||
|
||||
public abstract class ApiBase
|
||||
{
|
||||
internal const int PropertyTimeout = 1000;
|
||||
|
||||
private readonly string objectName;
|
||||
private readonly ConcurrentDictionary<string, PropertyGetter> propertyGetters = new ConcurrentDictionary<string, PropertyGetter>();
|
||||
private readonly ConcurrentDictionary<string, string> propertyEventNames = new ConcurrentDictionary<string, string>();
|
||||
private readonly ConcurrentDictionary<string, string> propertyMessageNames = new ConcurrentDictionary<string, string>();
|
||||
private readonly ConcurrentDictionary<string, string> methodMessageNames = new ConcurrentDictionary<string, string>();
|
||||
private readonly object objLock = new object();
|
||||
|
||||
public virtual int Id
|
||||
{
|
||||
get
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ReSharper disable once ValueParameterNotUsed
|
||||
protected set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract string SocketEventCompleteSuffix { get; }
|
||||
|
||||
protected ApiBase()
|
||||
{
|
||||
this.objectName = this.GetType().Name.LowerFirst();
|
||||
}
|
||||
|
||||
protected void CallMethod0([CallerMemberName] string callerName = null)
|
||||
{
|
||||
var messageName = this.methodMessageNames.GetOrAdd(callerName, s => this.objectName + s);
|
||||
if (this.Id >= 0)
|
||||
{
|
||||
BridgeConnector.Socket.Emit(messageName, this.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
BridgeConnector.Socket.Emit(messageName);
|
||||
}
|
||||
}
|
||||
|
||||
protected void CallMethod1(object val1, [CallerMemberName] string callerName = null)
|
||||
{
|
||||
var messageName = this.methodMessageNames.GetOrAdd(callerName, s => this.objectName + s);
|
||||
if (this.Id >= 0)
|
||||
{
|
||||
BridgeConnector.Socket.Emit(messageName, this.Id, val1);
|
||||
}
|
||||
else
|
||||
{
|
||||
BridgeConnector.Socket.Emit(messageName, val1);
|
||||
}
|
||||
}
|
||||
|
||||
protected void CallMethod2(object val1, object val2, [CallerMemberName] string callerName = null)
|
||||
{
|
||||
var messageName = this.methodMessageNames.GetOrAdd(callerName, s => this.objectName + s);
|
||||
if (this.Id >= 0)
|
||||
{
|
||||
BridgeConnector.Socket.Emit(messageName, this.Id, val1, val2);
|
||||
}
|
||||
else
|
||||
{
|
||||
BridgeConnector.Socket.Emit(messageName, val1, val2);
|
||||
}
|
||||
}
|
||||
|
||||
protected void CallMethod3(object val1, object val2, object val3, [CallerMemberName] string callerName = null)
|
||||
{
|
||||
var messageName = this.methodMessageNames.GetOrAdd(callerName, s => this.objectName + s);
|
||||
if (this.Id >= 0)
|
||||
{
|
||||
BridgeConnector.Socket.Emit(messageName, this.Id, val1, val2, val3);
|
||||
}
|
||||
else
|
||||
{
|
||||
BridgeConnector.Socket.Emit(messageName, val1, val2, val3);
|
||||
}
|
||||
}
|
||||
|
||||
protected Task<T> GetPropertyAsync<T>([CallerMemberName] string callerName = null)
|
||||
{
|
||||
Debug.Assert(callerName != null, nameof(callerName) + " != null");
|
||||
|
||||
lock (this.objLock)
|
||||
{
|
||||
return this.propertyGetters.GetOrAdd(callerName, _ =>
|
||||
{
|
||||
var getter = new PropertyGetter<T>(this, callerName, PropertyTimeout);
|
||||
|
||||
getter.Task<T>().ContinueWith(_ =>
|
||||
{
|
||||
lock (this.objLock)
|
||||
{
|
||||
return this.propertyGetters.TryRemove(callerName, out var _);
|
||||
}
|
||||
});
|
||||
|
||||
return getter;
|
||||
}).Task<T>();
|
||||
}
|
||||
}
|
||||
|
||||
internal abstract class PropertyGetter
|
||||
{
|
||||
public abstract Task<T> Task<T>();
|
||||
}
|
||||
|
||||
internal class PropertyGetter<T> : PropertyGetter
|
||||
{
|
||||
private readonly Task<T> tcsTask;
|
||||
private TaskCompletionSource<T> tcs;
|
||||
|
||||
public PropertyGetter(ApiBase apiBase, string callerName, int timeoutMs)
|
||||
{
|
||||
this.tcs = new TaskCompletionSource<T>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
this.tcsTask = this.tcs.Task;
|
||||
|
||||
var eventName = apiBase.propertyEventNames.GetOrAdd(callerName, s => $"{apiBase.objectName}-{s.StripAsync().LowerFirst()}{apiBase.SocketEventCompleteSuffix}");
|
||||
var messageName = apiBase.propertyMessageNames.GetOrAdd(callerName, s => apiBase.objectName + s.StripAsync());
|
||||
|
||||
BridgeConnector.Socket.On<T>(eventName, (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off(eventName);
|
||||
|
||||
lock (this)
|
||||
{
|
||||
this.tcs?.SetResult(result);
|
||||
this.tcs = null;
|
||||
}
|
||||
});
|
||||
|
||||
if (apiBase.Id >= 0)
|
||||
{
|
||||
BridgeConnector.Socket.Emit(messageName, apiBase.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
BridgeConnector.Socket.Emit(messageName);
|
||||
}
|
||||
|
||||
System.Threading.Tasks.Task.Delay(ApiBase.PropertyTimeout).ContinueWith(_ =>
|
||||
{
|
||||
if (this.tcs != null)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
if (this.tcs != null)
|
||||
{
|
||||
var ex = new TimeoutException($"No response after {timeoutMs:D}ms trying to retrieve value {apiBase.objectName}.{callerName}()");
|
||||
this.tcs.TrySetException(ex);
|
||||
this.tcs = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override Task<T1> Task<T1>()
|
||||
{
|
||||
return this.tcsTask as Task<T1>;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,15 +7,19 @@ using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.API.Extensions;
|
||||
using static System.Collections.Specialized.BitVector32;
|
||||
using ElectronNET.Common;
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
/// <summary>
|
||||
/// Control your application's event lifecycle.
|
||||
/// </summary>
|
||||
public sealed class App
|
||||
public sealed class App : ApiBase
|
||||
{
|
||||
protected override string SocketEventCompleteSuffix => "Completed";
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when all windows have been closed.
|
||||
/// <para/>
|
||||
@@ -39,7 +43,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-window-all-closed-event", GetHashCode());
|
||||
BridgeConnector.Socket.Emit("register-app-window-all-closed", GetHashCode());
|
||||
}
|
||||
_windowAllClosed += value;
|
||||
}
|
||||
@@ -111,7 +115,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-before-quit-event", GetHashCode());
|
||||
BridgeConnector.Socket.Emit("register-app-before-quit", GetHashCode());
|
||||
}
|
||||
_beforeQuit += value;
|
||||
}
|
||||
@@ -162,7 +166,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-will-quit-event", GetHashCode());
|
||||
BridgeConnector.Socket.Emit("register-app-will-quit", GetHashCode());
|
||||
}
|
||||
_willQuit += value;
|
||||
}
|
||||
@@ -197,7 +201,7 @@ namespace ElectronNET.API
|
||||
}
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-will-quit-event", GetHashCode() + "quitting");
|
||||
BridgeConnector.Socket.Emit("register-app-will-quit", GetHashCode() + "quitting");
|
||||
}
|
||||
_quitting += value;
|
||||
}
|
||||
@@ -217,26 +221,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action BrowserWindowBlur
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_browserWindowBlur == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("app-browser-window-blur" + GetHashCode(), () =>
|
||||
{
|
||||
_browserWindowBlur();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-browser-window-blur-event", GetHashCode());
|
||||
}
|
||||
_browserWindowBlur += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_browserWindowBlur -= value;
|
||||
|
||||
if (_browserWindowBlur == null)
|
||||
BridgeConnector.Socket.Off("app-browser-window-blur" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("app-browser-window-blur", GetHashCode(), _browserWindowBlur, value);
|
||||
remove => ApiEventManager.RemoveEvent("app-browser-window-blur", GetHashCode(), _browserWindowBlur, value);
|
||||
}
|
||||
|
||||
private event Action _browserWindowBlur;
|
||||
@@ -246,26 +232,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action BrowserWindowFocus
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_browserWindowFocus == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("app-browser-window-focus" + GetHashCode(), () =>
|
||||
{
|
||||
_browserWindowFocus();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-browser-window-focus-event", GetHashCode());
|
||||
}
|
||||
_browserWindowFocus += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_browserWindowFocus -= value;
|
||||
|
||||
if (_browserWindowFocus == null)
|
||||
BridgeConnector.Socket.Off("app-browser-window-focus" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("app-browser-window-focus", GetHashCode(), _browserWindowFocus, value);
|
||||
remove => ApiEventManager.RemoveEvent("app-browser-window-focus", GetHashCode(), _browserWindowFocus, value);
|
||||
}
|
||||
|
||||
private event Action _browserWindowFocus;
|
||||
@@ -275,26 +243,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action BrowserWindowCreated
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_browserWindowCreated == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("app-browser-window-created" + GetHashCode(), () =>
|
||||
{
|
||||
_browserWindowCreated();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-browser-window-created-event", GetHashCode());
|
||||
}
|
||||
_browserWindowCreated += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_browserWindowCreated -= value;
|
||||
|
||||
if (_browserWindowCreated == null)
|
||||
BridgeConnector.Socket.Off("app-browser-window-created" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("app-browser-window-created", GetHashCode(), _browserWindowCreated, value);
|
||||
remove => ApiEventManager.RemoveEvent("app-browser-window-created", GetHashCode(), _browserWindowCreated, value);
|
||||
}
|
||||
|
||||
private event Action _browserWindowCreated;
|
||||
@@ -304,26 +254,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action WebContentsCreated
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_webContentsCreated == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("app-web-contents-created" + GetHashCode(), () =>
|
||||
{
|
||||
_webContentsCreated();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-web-contents-created-event", GetHashCode());
|
||||
}
|
||||
_webContentsCreated += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_webContentsCreated -= value;
|
||||
|
||||
if (_webContentsCreated == null)
|
||||
BridgeConnector.Socket.Off("app-web-contents-created" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("app-web-contents-created", GetHashCode(), _webContentsCreated, value);
|
||||
remove => ApiEventManager.RemoveEvent("app-web-contents-created", GetHashCode(), _webContentsCreated, value);
|
||||
}
|
||||
|
||||
private event Action _webContentsCreated;
|
||||
@@ -335,26 +267,8 @@ namespace ElectronNET.API
|
||||
/// <returns><see langword="true"/> when Chrome's accessibility support is enabled, <see langword="false"/> otherwise.</returns>
|
||||
public event Action<bool> AccessibilitySupportChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_accessibilitySupportChanged == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("app-accessibility-support-changed" + GetHashCode(), (state) =>
|
||||
{
|
||||
_accessibilitySupportChanged((bool)state);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-accessibility-support-changed-event", GetHashCode());
|
||||
}
|
||||
_accessibilitySupportChanged += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_accessibilitySupportChanged -= value;
|
||||
|
||||
if (_accessibilitySupportChanged == null)
|
||||
BridgeConnector.Socket.Off("app-accessibility-support-changed" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("app-accessibility-support-changed", GetHashCode(), _accessibilitySupportChanged, value, (args) => (bool)args);
|
||||
remove => ApiEventManager.RemoveEvent("app-accessibility-support-changed", GetHashCode(), _accessibilitySupportChanged, value);
|
||||
}
|
||||
|
||||
private event Action<bool> _accessibilitySupportChanged;
|
||||
@@ -408,26 +322,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<string> OpenFile
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_openFile == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("app-open-file" + GetHashCode(), (file) =>
|
||||
{
|
||||
_openFile(file.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-open-file-event", GetHashCode());
|
||||
}
|
||||
_openFile += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_openFile -= value;
|
||||
|
||||
if (_openFile == null)
|
||||
BridgeConnector.Socket.Off("app-open-file" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("app-open-file", GetHashCode(), _openFile, value, (args) => args.ToString());
|
||||
remove => ApiEventManager.RemoveEvent("app-open-file", GetHashCode(), _openFile, value);
|
||||
}
|
||||
|
||||
private event Action<string> _openFile;
|
||||
@@ -439,26 +335,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<string> OpenUrl
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_openUrl == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("app-open-url" + GetHashCode(), (url) =>
|
||||
{
|
||||
_openUrl(url.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-app-open-url-event", GetHashCode());
|
||||
}
|
||||
_openUrl += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_openUrl -= value;
|
||||
|
||||
if (_openUrl == null)
|
||||
BridgeConnector.Socket.Off("app-open-url" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("app-open-url", GetHashCode(), _openUrl, value, (args) => args.ToString());
|
||||
remove => ApiEventManager.RemoveEvent("app-open-url", GetHashCode(), _openUrl, value);
|
||||
}
|
||||
|
||||
private event Action<string> _openUrl;
|
||||
@@ -496,20 +374,7 @@ namespace ElectronNET.API
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run<string>(() =>
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
|
||||
BridgeConnector.Socket.On("appGetNameCompleted", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("appGetNameCompleted");
|
||||
taskCompletionSource.SetResult((string)result);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("appGetName");
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
});
|
||||
return this.GetPropertyAsync<string>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,7 +419,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public void Quit()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appQuit");
|
||||
this.CallMethod0();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -564,7 +429,7 @@ namespace ElectronNET.API
|
||||
/// <param name="exitCode">Exits immediately with exitCode. exitCode defaults to 0.</param>
|
||||
public void Exit(int exitCode = 0)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appExit", exitCode);
|
||||
this.CallMethod1(exitCode);
|
||||
}
|
||||
|
||||
public void DisposeSocket()
|
||||
@@ -584,7 +449,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public void Relaunch()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appRelaunch");
|
||||
this.CallMethod0();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -602,7 +467,7 @@ namespace ElectronNET.API
|
||||
/// <param name="relaunchOptions">Options for the relaunch.</param>
|
||||
public void Relaunch(RelaunchOptions relaunchOptions)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appRelaunch", JObject.FromObject(relaunchOptions, _jsonSerializer));
|
||||
this.CallMethod1(JObject.FromObject(relaunchOptions, _jsonSerializer));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -611,7 +476,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public void Focus()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appFocus");
|
||||
this.CallMethod0();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -622,7 +487,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public void Focus(FocusOptions focusOptions)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appFocus", JObject.FromObject(focusOptions, _jsonSerializer));
|
||||
this.CallMethod1(JObject.FromObject(focusOptions, _jsonSerializer));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -630,7 +495,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public void Hide()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appHide");
|
||||
this.CallMethod0();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -638,7 +503,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public void Show()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appShow");
|
||||
this.CallMethod0();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -647,21 +512,7 @@ namespace ElectronNET.API
|
||||
public async Task<string> GetAppPathAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
using(cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
||||
{
|
||||
BridgeConnector.Socket.On("appGetAppPathCompleted", (path) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("appGetAppPathCompleted");
|
||||
taskCompletionSource.SetResult(path.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("appGetAppPath");
|
||||
|
||||
return await taskCompletionSource.Task
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
return await this.GetPropertyAsync<string>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -674,7 +525,7 @@ namespace ElectronNET.API
|
||||
/// <param name="path">A custom path for your logs. Must be absolute.</param>
|
||||
public void SetAppLogsPath(string path)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appSetAppLogsPath", path);
|
||||
this.CallMethod1(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -720,7 +571,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public void SetPath(PathName name, string path)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appSetPath", name.GetDescription(), path);
|
||||
this.CallMethod2(name.GetDescription(), path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -731,21 +582,7 @@ namespace ElectronNET.API
|
||||
public async Task<string> GetVersionAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
using(cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
||||
{
|
||||
BridgeConnector.Socket.On("appGetVersionCompleted", (version) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("appGetVersionCompleted");
|
||||
taskCompletionSource.SetResult(version.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("appGetVersion");
|
||||
|
||||
return await taskCompletionSource.Task
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
return await this.GetPropertyAsync<string>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -759,21 +596,7 @@ namespace ElectronNET.API
|
||||
public async Task<string> GetLocaleAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
||||
{
|
||||
BridgeConnector.Socket.On("appGetLocaleCompleted", (local) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("appGetLocaleCompleted");
|
||||
taskCompletionSource.SetResult(local.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("appGetLocale");
|
||||
|
||||
return await taskCompletionSource.Task
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
return await this.GetPropertyAsync<string>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -783,7 +606,7 @@ namespace ElectronNET.API
|
||||
/// <param name="path">Path to add.</param>
|
||||
public void AddRecentDocument(string path)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appAddRecentDocument", path);
|
||||
this.CallMethod1(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -791,7 +614,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public void ClearRecentDocuments()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appClearRecentDocuments");
|
||||
this.CallMethod0();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1064,21 +887,7 @@ namespace ElectronNET.API
|
||||
public async Task<JumpListSettings> GetJumpListSettingsAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<JumpListSettings>();
|
||||
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
||||
{
|
||||
BridgeConnector.Socket.On("appGetJumpListSettingsCompleted", (jumpListSettings) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("appGetJumpListSettingsCompleted");
|
||||
taskCompletionSource.SetResult(JObject.Parse(jumpListSettings.ToString()).ToObject<JumpListSettings>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("appGetJumpListSettings");
|
||||
|
||||
return await taskCompletionSource.Task
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
return await this.GetPropertyAsync<JumpListSettings>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1099,7 +908,7 @@ namespace ElectronNET.API
|
||||
/// <param name="categories">Array of <see cref="JumpListCategory"/> objects.</param>
|
||||
public void SetJumpList(JumpListCategory[] categories)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appSetJumpList", JArray.FromObject(categories, _jsonSerializer));
|
||||
this.CallMethod1(JArray.FromObject(categories, _jsonSerializer));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1159,7 +968,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public void ReleaseSingleInstanceLock()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appReleaseSingleInstanceLock");
|
||||
this.CallMethod0();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1171,21 +980,7 @@ namespace ElectronNET.API
|
||||
public async Task<bool> HasSingleInstanceLockAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
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);
|
||||
}
|
||||
return await this.GetPropertyAsync<bool>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1214,7 +1009,7 @@ namespace ElectronNET.API
|
||||
/// </param>
|
||||
public void SetUserActivity(string type, object userInfo, string webpageUrl)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appSetUserActivity", type, userInfo, webpageUrl);
|
||||
this.CallMethod3(type, userInfo, webpageUrl);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1224,21 +1019,7 @@ namespace ElectronNET.API
|
||||
public async Task<string> GetCurrentActivityTypeAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
||||
{
|
||||
BridgeConnector.Socket.On("appGetCurrentActivityTypeCompleted", (activityType) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("appGetCurrentActivityTypeCompleted");
|
||||
taskCompletionSource.SetResult(activityType.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("appGetCurrentActivityType");
|
||||
|
||||
return await taskCompletionSource.Task
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
return await this.GetPropertyAsync<string>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1246,7 +1027,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public void InvalidateCurrentActivity()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appInvalidateCurrentActivity");
|
||||
this.CallMethod0();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1254,7 +1035,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public void ResignCurrentActivity()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appResignCurrentActivity");
|
||||
this.CallMethod0();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1263,7 +1044,7 @@ namespace ElectronNET.API
|
||||
/// <param name="id">Model Id.</param>
|
||||
public void SetAppUserModelId(string id)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appSetAppUserModelId", id);
|
||||
this.CallMethod1(id);
|
||||
}
|
||||
|
||||
/// TODO: Check new parameter which is a function [App.ImportCertificate]
|
||||
@@ -1306,23 +1087,7 @@ namespace ElectronNET.API
|
||||
public async Task<ProcessMetric[]> GetAppMetricsAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<ProcessMetric[]>();
|
||||
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
||||
{
|
||||
BridgeConnector.Socket.On("appGetAppMetricsCompleted", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("appGetAppMetricsCompleted");
|
||||
var processMetrics = ((JArray)result).ToObject<ProcessMetric[]>();
|
||||
|
||||
taskCompletionSource.SetResult(processMetrics);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("appGetAppMetrics");
|
||||
|
||||
return await taskCompletionSource.Task
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
return await this.GetPropertyAsync<ProcessMetric[]>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1334,23 +1099,7 @@ namespace ElectronNET.API
|
||||
public async Task<GPUFeatureStatus> GetGpuFeatureStatusAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<GPUFeatureStatus>();
|
||||
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
||||
{
|
||||
BridgeConnector.Socket.On("appGetGpuFeatureStatusCompleted", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("appGetGpuFeatureStatusCompleted");
|
||||
var gpuFeatureStatus = ((JObject)result).ToObject<GPUFeatureStatus>();
|
||||
|
||||
taskCompletionSource.SetResult(gpuFeatureStatus);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("appGetGpuFeatureStatus");
|
||||
|
||||
return await taskCompletionSource.Task
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
return await this.GetPropertyAsync<GPUFeatureStatus>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1390,21 +1139,7 @@ namespace ElectronNET.API
|
||||
public async Task<int> GetBadgeCountAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<int>();
|
||||
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
||||
{
|
||||
BridgeConnector.Socket.On("appGetBadgeCountCompleted", (count) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("appGetBadgeCountCompleted");
|
||||
taskCompletionSource.SetResult((int)count);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("appGetBadgeCount");
|
||||
|
||||
return await taskCompletionSource.Task
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
return await this.GetPropertyAsync<int>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1419,21 +1154,7 @@ namespace ElectronNET.API
|
||||
public async Task<bool> IsUnityRunningAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
||||
{
|
||||
BridgeConnector.Socket.On("appIsUnityRunningCompleted", (isUnityRunning) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("appIsUnityRunningCompleted");
|
||||
taskCompletionSource.SetResult((bool)isUnityRunning);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("appIsUnityRunning");
|
||||
|
||||
return await taskCompletionSource.Task
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
return await this.GetPropertyAsync<bool>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1489,7 +1210,7 @@ namespace ElectronNET.API
|
||||
/// <param name="loginSettings"></param>
|
||||
public void SetLoginItemSettings(LoginSettings loginSettings)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appSetLoginItemSettings", JObject.FromObject(loginSettings, _jsonSerializer));
|
||||
this.CallMethod1(JObject.FromObject(loginSettings, _jsonSerializer));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1501,21 +1222,7 @@ namespace ElectronNET.API
|
||||
public async Task<bool> IsAccessibilitySupportEnabledAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
using (cancellationToken.Register(() => taskCompletionSource.TrySetCanceled()))
|
||||
{
|
||||
BridgeConnector.Socket.On("appIsAccessibilitySupportEnabledCompleted", (isAccessibilitySupportEnabled) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("appIsAccessibilitySupportEnabledCompleted");
|
||||
taskCompletionSource.SetResult((bool)isAccessibilitySupportEnabled);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("appIsAccessibilitySupportEnabled");
|
||||
|
||||
return await taskCompletionSource.Task
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
return await this.GetPropertyAsync<bool>().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1530,7 +1237,7 @@ namespace ElectronNET.API
|
||||
/// <param name="enabled">Enable or disable <see href="https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/the-accessibility-tree">accessibility tree</see> rendering.</param>
|
||||
public void SetAccessibilitySupportEnabled(bool enabled)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appSetAccessibilitySupportEnabled", enabled);
|
||||
this.CallMethod1(enabled);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1539,7 +1246,7 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public void ShowAboutPanel()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appShowAboutPanel");
|
||||
this.CallMethod0();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1555,7 +1262,7 @@ namespace ElectronNET.API
|
||||
/// <param name="options">About panel options.</param>
|
||||
public void SetAboutPanelOptions(AboutPanelOptions options)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("appSetAboutPanelOptions", JObject.FromObject(options, _jsonSerializer));
|
||||
this.CallMethod1(JObject.FromObject(options, _jsonSerializer));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1591,20 +1298,7 @@ namespace ElectronNET.API
|
||||
{
|
||||
get
|
||||
{
|
||||
return Task.Run<string>(() =>
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
|
||||
BridgeConnector.Socket.On("appGetUserAgentFallbackCompleted", (result) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("appGetUserAgentFallbackCompleted");
|
||||
taskCompletionSource.SetResult((string)result);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("appGetUserAgentFallback");
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
});
|
||||
return this.GetPropertyAsync<string>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.Common;
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
@@ -286,26 +288,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<string> OnError
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_error == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-error" + GetHashCode(), (message) =>
|
||||
{
|
||||
_error(message.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-error-event", GetHashCode());
|
||||
}
|
||||
_error += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_error -= value;
|
||||
|
||||
if (_error == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-error" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("autoUpdater-error", GetHashCode(), _error, value, (args) => args.ToString());
|
||||
remove => ApiEventManager.RemoveEvent("autoUpdater-error", GetHashCode(), _error, value);
|
||||
}
|
||||
|
||||
private event Action<string> _error;
|
||||
@@ -315,26 +299,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnCheckingForUpdate
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_checkingForUpdate == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-checking-for-update" + GetHashCode(), () =>
|
||||
{
|
||||
_checkingForUpdate();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-checking-for-update-event", GetHashCode());
|
||||
}
|
||||
_checkingForUpdate += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_checkingForUpdate -= value;
|
||||
|
||||
if (_checkingForUpdate == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-checking-for-update" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("autoUpdater-checking-for-update", GetHashCode(), _checkingForUpdate, value);
|
||||
remove => ApiEventManager.RemoveEvent("autoUpdater-checking-for-update", GetHashCode(), _checkingForUpdate, value);
|
||||
}
|
||||
|
||||
private event Action _checkingForUpdate;
|
||||
@@ -345,26 +311,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<UpdateInfo> OnUpdateAvailable
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_updateAvailable == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-update-available" + GetHashCode(), (updateInfo) =>
|
||||
{
|
||||
_updateAvailable(JObject.Parse(updateInfo.ToString()).ToObject<UpdateInfo>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-update-available-event", GetHashCode());
|
||||
}
|
||||
_updateAvailable += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_updateAvailable -= value;
|
||||
|
||||
if (_updateAvailable == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-update-available" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("autoUpdater-update-available", GetHashCode(), _updateAvailable, value, (args) => JObject.Parse(args.ToString()).ToObject<UpdateInfo>());
|
||||
remove => ApiEventManager.RemoveEvent("autoUpdater-update-available", GetHashCode(), _updateAvailable, value);
|
||||
}
|
||||
|
||||
private event Action<UpdateInfo> _updateAvailable;
|
||||
@@ -374,26 +322,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<UpdateInfo> OnUpdateNotAvailable
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_updateNotAvailable == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-update-not-available" + GetHashCode(), (updateInfo) =>
|
||||
{
|
||||
_updateNotAvailable(JObject.Parse(updateInfo.ToString()).ToObject<UpdateInfo>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-update-not-available-event", GetHashCode());
|
||||
}
|
||||
_updateNotAvailable += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_updateNotAvailable -= value;
|
||||
|
||||
if (_updateNotAvailable == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-update-not-available" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("autoUpdater-update-not-available", GetHashCode(), _updateNotAvailable, value, (args) => JObject.Parse(args.ToString()).ToObject<UpdateInfo>());
|
||||
remove => ApiEventManager.RemoveEvent("autoUpdater-update-not-available", GetHashCode(), _updateNotAvailable, value);
|
||||
}
|
||||
|
||||
private event Action<UpdateInfo> _updateNotAvailable;
|
||||
@@ -403,26 +333,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<ProgressInfo> OnDownloadProgress
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_downloadProgress == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-download-progress" + GetHashCode(), (progressInfo) =>
|
||||
{
|
||||
_downloadProgress(JObject.Parse(progressInfo.ToString()).ToObject<ProgressInfo>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-download-progress-event", GetHashCode());
|
||||
}
|
||||
_downloadProgress += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_downloadProgress -= value;
|
||||
|
||||
if (_downloadProgress == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-download-progress" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("autoUpdater-download-progress", GetHashCode(), _downloadProgress, value, (args) => JObject.Parse(args.ToString()).ToObject<ProgressInfo>());
|
||||
remove => ApiEventManager.RemoveEvent("autoUpdater-download-progress", GetHashCode(), _downloadProgress, value);
|
||||
}
|
||||
|
||||
private event Action<ProgressInfo> _downloadProgress;
|
||||
@@ -432,26 +344,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<UpdateInfo> OnUpdateDownloaded
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_updateDownloaded == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("autoUpdater-update-downloaded" + GetHashCode(), (updateInfo) =>
|
||||
{
|
||||
_updateDownloaded(JObject.Parse(updateInfo.ToString()).ToObject<UpdateInfo>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-autoUpdater-update-downloaded-event", GetHashCode());
|
||||
}
|
||||
_updateDownloaded += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_updateDownloaded -= value;
|
||||
|
||||
if (_updateDownloaded == null)
|
||||
BridgeConnector.Socket.Off("autoUpdater-update-downloaded" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("autoUpdater-update-downloaded", GetHashCode(), _updateDownloaded, value, (args) => JObject.Parse(args.ToString()).ToObject<UpdateInfo>());
|
||||
remove => ApiEventManager.RemoveEvent("autoUpdater-update-downloaded", GetHashCode(), _updateDownloaded, value);
|
||||
}
|
||||
|
||||
private event Action<UpdateInfo> _updateDownloaded;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using ElectronNET.Converter;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System.ComponentModel;
|
||||
|
||||
@@ -199,7 +200,7 @@ namespace ElectronNET.API.Entities
|
||||
public bool DarkTheme { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Makes the window . Default is false.
|
||||
/// Makes the window transparent. Default is false.
|
||||
/// </summary>
|
||||
public bool Transparent { get; set; }
|
||||
|
||||
@@ -215,6 +216,18 @@ namespace ElectronNET.API.Entities
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public TitleBarStyle TitleBarStyle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Configures the window's title bar overlay when using a frameless window.
|
||||
/// Can be either:
|
||||
/// - false: No title bar overlay.
|
||||
/// - true: Enables the default title bar overlay.
|
||||
/// - An object defining custom overlay options (such as height, color, etc.).
|
||||
///
|
||||
/// Default is false.
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(TitleBarOverlayConverter))]
|
||||
public TitleBarOverlay TitleBarOverlay { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Shows the title in the tile bar in full screen mode on macOS for all
|
||||
/// titleBarStyle options.Default is false.
|
||||
@@ -229,6 +242,15 @@ namespace ElectronNET.API.Entities
|
||||
[DefaultValue(true)]
|
||||
public bool ThickFrame { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether frameless window should have rounded corners. Default is true. Setting this
|
||||
/// property to false will prevent the window from being fullscreenable on macOS. On
|
||||
/// Windows versions older than Windows 11 Build 22000 this property has no effect, and
|
||||
/// frameless windows will not have rounded corners.
|
||||
/// </summary>
|
||||
[DefaultValue(true)]
|
||||
public bool RoundedCorners { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Add a type of vibrancy effect to the window, only on macOS. Can be
|
||||
/// appearance-based, light, dark, titlebar, selection, menu, popover, sidebar,
|
||||
|
||||
20
src/ElectronNET.API/API/Entities/PageSize.cs
Normal file
20
src/ElectronNET.API/API/Entities/PageSize.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace ElectronNET.API.Entities;
|
||||
|
||||
public class PageSize
|
||||
{
|
||||
private readonly string _value;
|
||||
|
||||
public PageSize()
|
||||
{
|
||||
}
|
||||
|
||||
private PageSize(string value) : this() => _value = value;
|
||||
|
||||
public double Height { get; set; }
|
||||
|
||||
public double Width { get; set; }
|
||||
|
||||
public static implicit operator string(PageSize pageSize) => pageSize?._value;
|
||||
|
||||
public static implicit operator PageSize(string value) => new(value);
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
namespace ElectronNET.API.Entities;
|
||||
using ElectronNET.Converter;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ElectronNET.API.Entities;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -30,7 +33,8 @@ public class PrintToPDFOptions
|
||||
/// `A5`, `A6`, `Legal`, `Letter`, `Tabloid`, `Ledger`, or an Object containing
|
||||
/// `height` and `width` in inches. Defaults to `Letter`.
|
||||
/// </summary>
|
||||
public object PageSize { get; set; } = "Letter";
|
||||
[JsonConverter(typeof(PageSizeConverter))]
|
||||
public PageSize PageSize { get; set; } = "Letter";
|
||||
|
||||
/// <summary>
|
||||
/// Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string,
|
||||
|
||||
22
src/ElectronNET.API/API/Entities/TitleBarOverlay.cs
Normal file
22
src/ElectronNET.API/API/Entities/TitleBarOverlay.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace ElectronNET.API.Entities;
|
||||
|
||||
public class TitleBarOverlay
|
||||
{
|
||||
private readonly bool? _value;
|
||||
|
||||
public TitleBarOverlay()
|
||||
{
|
||||
}
|
||||
|
||||
private TitleBarOverlay(bool value) : this() => _value = value;
|
||||
|
||||
public string Color { get; set; }
|
||||
|
||||
public double Height { get; set; }
|
||||
|
||||
public string SymbolColor { get; set; }
|
||||
|
||||
public static implicit operator bool?(TitleBarOverlay titleBarOverlay) => titleBarOverlay?._value;
|
||||
|
||||
public static implicit operator TitleBarOverlay(bool value) => new(value);
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.API.Entities;
|
||||
using ElectronNET.API.Extensions;
|
||||
using ElectronNET.Common;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
@@ -183,28 +184,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action Updated
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_updated == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("nativeTheme-updated" + GetHashCode(), () =>
|
||||
{
|
||||
_updated();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-nativeTheme-updated-event", GetHashCode());
|
||||
}
|
||||
_updated += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_updated -= value;
|
||||
|
||||
if (_updated == null)
|
||||
{
|
||||
BridgeConnector.Socket.Off("nativeTheme-updated" + GetHashCode());
|
||||
}
|
||||
}
|
||||
add => ApiEventManager.AddEvent("nativeTheme-updated", GetHashCode(), _updated, value);
|
||||
remove => ApiEventManager.RemoveEvent("nativeTheme-updated", GetHashCode(), _updated, value);
|
||||
}
|
||||
|
||||
private event Action _updated;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.Common;
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
@@ -13,26 +15,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnLockScreen
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_lockScreen == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("pm-lock-screen" , () =>
|
||||
{
|
||||
_lockScreen();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-pm-lock-screen");
|
||||
}
|
||||
_lockScreen += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_lockScreen -= value;
|
||||
|
||||
if (_lockScreen == null)
|
||||
BridgeConnector.Socket.Off("pm-lock-screen");
|
||||
}
|
||||
add => ApiEventManager.AddEvent("pm-lock-screen", string.Empty, _lockScreen, value);
|
||||
remove => ApiEventManager.RemoveEvent("pm-lock-screen", string.Empty, _lockScreen, value);
|
||||
}
|
||||
|
||||
private event Action _lockScreen;
|
||||
@@ -42,26 +26,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnUnLockScreen
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_unlockScreen == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("pm-unlock-screen", () =>
|
||||
{
|
||||
_unlockScreen();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-pm-unlock-screen");
|
||||
}
|
||||
_unlockScreen += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_unlockScreen -= value;
|
||||
|
||||
if (_unlockScreen == null)
|
||||
BridgeConnector.Socket.Off("pm-unlock-screen");
|
||||
}
|
||||
add => ApiEventManager.AddEvent("pm-unlock-screen", string.Empty, _unlockScreen, value);
|
||||
remove => ApiEventManager.RemoveEvent("pm-unlock-screen", string.Empty, _unlockScreen, value);
|
||||
}
|
||||
|
||||
private event Action _unlockScreen;
|
||||
@@ -71,26 +37,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnSuspend
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_suspend == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("pm-suspend", () =>
|
||||
{
|
||||
_suspend();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-pm-suspend");
|
||||
}
|
||||
_suspend += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_suspend -= value;
|
||||
|
||||
if (_suspend == null)
|
||||
BridgeConnector.Socket.Off("pm-suspend");
|
||||
}
|
||||
add => ApiEventManager.AddEvent("pm-suspend", string.Empty, _suspend, value);
|
||||
remove => ApiEventManager.RemoveEvent("pm-suspend", string.Empty, _suspend, value);
|
||||
}
|
||||
|
||||
private event Action _suspend;
|
||||
@@ -100,26 +48,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnResume
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_resume == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("pm-resume", () =>
|
||||
{
|
||||
_resume();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-pm-resume");
|
||||
}
|
||||
_resume += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_resume -= value;
|
||||
|
||||
if (_resume == null)
|
||||
BridgeConnector.Socket.Off("pm-resume");
|
||||
}
|
||||
add => ApiEventManager.AddEvent("pm-resume", string.Empty, _resume, value);
|
||||
remove => ApiEventManager.RemoveEvent("pm-resume", string.Empty, _resume, value);
|
||||
}
|
||||
|
||||
private event Action _resume;
|
||||
@@ -129,26 +59,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnAC
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_onAC == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("pm-on-ac", () =>
|
||||
{
|
||||
_onAC();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-pm-on-ac");
|
||||
}
|
||||
_onAC += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_onAC -= value;
|
||||
|
||||
if (_onAC == null)
|
||||
BridgeConnector.Socket.Off("pm-on-ac");
|
||||
}
|
||||
add => ApiEventManager.AddEvent("pm-on-ac", string.Empty, _onAC, value);
|
||||
remove => ApiEventManager.RemoveEvent("pm-on-ac", string.Empty, _onAC, value);
|
||||
}
|
||||
|
||||
private event Action _onAC;
|
||||
@@ -158,31 +70,12 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnBattery
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_onBattery == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("pm-on-battery", () =>
|
||||
{
|
||||
_onBattery();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-pm-on-battery");
|
||||
}
|
||||
_onBattery += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_onBattery -= value;
|
||||
|
||||
if (_onBattery == null)
|
||||
BridgeConnector.Socket.Off("pm-on-battery");
|
||||
}
|
||||
add => ApiEventManager.AddEvent("pm-on-battery", string.Empty, _onBattery, value);
|
||||
remove => ApiEventManager.RemoveEvent("pm-on-battery", string.Empty, _onBattery, value);
|
||||
}
|
||||
|
||||
private event Action _onBattery;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when the system is about to reboot or shut down. If the event handler
|
||||
/// invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
|
||||
@@ -191,26 +84,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnShutdown
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_shutdown == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("pm-shutdown", () =>
|
||||
{
|
||||
_shutdown();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-pm-shutdown");
|
||||
}
|
||||
_shutdown += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_shutdown -= value;
|
||||
|
||||
if (_shutdown == null)
|
||||
BridgeConnector.Socket.Off("pm-on-shutdown");
|
||||
}
|
||||
add => ApiEventManager.AddEvent("pm-shutdown", string.Empty, _shutdown, value);
|
||||
remove => ApiEventManager.RemoveEvent("pm-shutdown", string.Empty, _shutdown, value);
|
||||
}
|
||||
|
||||
private event Action _shutdown;
|
||||
|
||||
@@ -4,6 +4,7 @@ using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.Common;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
@@ -17,26 +18,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<Display> OnDisplayAdded
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_onDisplayAdded == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("screen-display-added-event" + GetHashCode(), (display) =>
|
||||
{
|
||||
_onDisplayAdded(((JObject)display).ToObject<Display>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-screen-display-added", GetHashCode());
|
||||
}
|
||||
_onDisplayAdded += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_onDisplayAdded -= value;
|
||||
|
||||
if (_onDisplayAdded == null)
|
||||
BridgeConnector.Socket.Off("screen-display-added-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("screen-display-added", GetHashCode(), _onDisplayAdded, value, (args) => ((JObject)args).ToObject<Display>());
|
||||
remove => ApiEventManager.RemoveEvent("screen-display-added", GetHashCode(), _onDisplayAdded, value);
|
||||
}
|
||||
|
||||
private event Action<Display> _onDisplayAdded;
|
||||
@@ -46,26 +29,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<Display> OnDisplayRemoved
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_onDisplayRemoved == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("screen-display-removed-event" + GetHashCode(), (display) =>
|
||||
{
|
||||
_onDisplayRemoved(((JObject)display).ToObject<Display>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-screen-display-removed", GetHashCode());
|
||||
}
|
||||
_onDisplayRemoved += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_onDisplayRemoved -= value;
|
||||
|
||||
if (_onDisplayRemoved == null)
|
||||
BridgeConnector.Socket.Off("screen-display-removed-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("screen-display-removed", GetHashCode(), _onDisplayRemoved, value, (args) => ((JObject)args).ToObject<Display>());
|
||||
remove => ApiEventManager.RemoveEvent("screen-display-removed", GetHashCode(), _onDisplayRemoved, value);
|
||||
}
|
||||
|
||||
private event Action<Display> _onDisplayRemoved;
|
||||
@@ -77,29 +42,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<Display, string[]> OnDisplayMetricsChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_onDisplayMetricsChanged == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("screen-display-metrics-changed-event" + GetHashCode(), (args) =>
|
||||
{
|
||||
var display = ((JArray)args).First.ToObject<Display>();
|
||||
var metrics = ((JArray)args).Last.ToObject<string[]>();
|
||||
|
||||
_onDisplayMetricsChanged(display, metrics);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-screen-display-metrics-changed", GetHashCode());
|
||||
}
|
||||
_onDisplayMetricsChanged += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_onDisplayMetricsChanged -= value;
|
||||
|
||||
if (_onDisplayMetricsChanged == null)
|
||||
BridgeConnector.Socket.Off("screen-display-metrics-changed-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddScreenEvent("screen-display-metrics-changed", GetHashCode(), _onDisplayMetricsChanged, value);
|
||||
remove => ApiEventManager.RemoveScreenEvent("screen-display-metrics-changed", GetHashCode(), _onDisplayMetricsChanged, value);
|
||||
}
|
||||
|
||||
private event Action<Display, string[]> _onDisplayMetricsChanged;
|
||||
|
||||
@@ -6,6 +6,8 @@ using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.Common;
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
@@ -19,29 +21,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<TrayClickEventArgs, Rectangle> OnClick
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_click == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<dynamic>("tray-click-event" + GetHashCode(), (result) =>
|
||||
{
|
||||
var args = ((JArray)result).ToObject<object[]>();
|
||||
var trayClickEventArgs = ((JObject)args[0]).ToObject<TrayClickEventArgs>();
|
||||
var bounds = ((JObject)args[1]).ToObject<Rectangle>();
|
||||
_click(trayClickEventArgs, bounds);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-tray-click", GetHashCode());
|
||||
}
|
||||
_click += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_click -= value;
|
||||
|
||||
if (_click == null)
|
||||
BridgeConnector.Socket.Off("tray-click-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddTrayEvent("tray-click", GetHashCode(), _click, value);
|
||||
remove => ApiEventManager.RemoveTrayEvent("tray-click", GetHashCode(), _click, value);
|
||||
}
|
||||
|
||||
private event Action<TrayClickEventArgs, Rectangle> _click;
|
||||
@@ -51,29 +32,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<TrayClickEventArgs, Rectangle> OnRightClick
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_rightClick == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<dynamic>("tray-right-click-event" + GetHashCode(), (result) =>
|
||||
{
|
||||
var args = ((JArray)result).ToObject<object[]>();
|
||||
var trayClickEventArgs = ((JObject)args[0]).ToObject<TrayClickEventArgs>();
|
||||
var bounds = ((JObject)args[1]).ToObject<Rectangle>();
|
||||
_rightClick(trayClickEventArgs, bounds);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-tray-right-click", GetHashCode());
|
||||
}
|
||||
_rightClick += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_rightClick -= value;
|
||||
|
||||
if (_rightClick == null)
|
||||
BridgeConnector.Socket.Off("tray-right-click-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddTrayEvent("tray-right-click", GetHashCode(), _rightClick, value);
|
||||
remove => ApiEventManager.RemoveTrayEvent("tray-right-click", GetHashCode(), _rightClick, value);
|
||||
}
|
||||
|
||||
private event Action<TrayClickEventArgs, Rectangle> _rightClick;
|
||||
@@ -83,29 +43,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action<TrayClickEventArgs, Rectangle> OnDoubleClick
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_doubleClick == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<dynamic>("tray-double-click-event" + GetHashCode(), (result) =>
|
||||
{
|
||||
var args = ((JArray)result).ToObject<object[]>();
|
||||
var trayClickEventArgs = ((JObject)args[0]).ToObject<TrayClickEventArgs>();
|
||||
var bounds = ((JObject)args[1]).ToObject<Rectangle>();
|
||||
_doubleClick(trayClickEventArgs, bounds);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-tray-double-click", GetHashCode());
|
||||
}
|
||||
_doubleClick += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_doubleClick -= value;
|
||||
|
||||
if (_doubleClick == null)
|
||||
BridgeConnector.Socket.Off("tray-double-click-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddTrayEvent("tray-double-click", GetHashCode(), _doubleClick, value);
|
||||
remove => ApiEventManager.RemoveTrayEvent("tray-double-click", GetHashCode(), _doubleClick, value);
|
||||
}
|
||||
|
||||
private event Action<TrayClickEventArgs, Rectangle> _doubleClick;
|
||||
@@ -115,26 +54,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnBalloonShow
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_balloonShow == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("tray-balloon-show-event" + GetHashCode(), () =>
|
||||
{
|
||||
_balloonShow();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-tray-balloon-show", GetHashCode());
|
||||
}
|
||||
_balloonShow += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_balloonShow -= value;
|
||||
|
||||
if (_balloonShow == null)
|
||||
BridgeConnector.Socket.Off("tray-balloon-show-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("tray-balloon-show", GetHashCode(), _balloonShow, value);
|
||||
remove => ApiEventManager.RemoveEvent("tray-balloon-show", GetHashCode(), _balloonShow, value);
|
||||
}
|
||||
|
||||
private event Action _balloonShow;
|
||||
@@ -144,26 +65,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnBalloonClick
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_balloonClick == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("tray-balloon-click-event" + GetHashCode(), () =>
|
||||
{
|
||||
_balloonClick();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-tray-balloon-click", GetHashCode());
|
||||
}
|
||||
_balloonClick += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_balloonClick -= value;
|
||||
|
||||
if (_balloonClick == null)
|
||||
BridgeConnector.Socket.Off("tray-balloon-click-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("tray-balloon-click", GetHashCode(), _balloonClick, value);
|
||||
remove => ApiEventManager.RemoveEvent("tray-balloon-click", GetHashCode(), _balloonClick, value);
|
||||
}
|
||||
|
||||
private event Action _balloonClick;
|
||||
@@ -174,26 +77,8 @@ namespace ElectronNET.API
|
||||
/// </summary>
|
||||
public event Action OnBalloonClosed
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_balloonClosed == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("tray-balloon-closed-event" + GetHashCode(), () =>
|
||||
{
|
||||
_balloonClosed();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-tray-balloon-closed", GetHashCode());
|
||||
}
|
||||
_balloonClosed += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_balloonClosed -= value;
|
||||
|
||||
if (_balloonClosed == null)
|
||||
BridgeConnector.Socket.Off("tray-balloon-closed-event" + GetHashCode());
|
||||
}
|
||||
add => ApiEventManager.AddEvent("tray-balloon-closed", GetHashCode(), _balloonClosed, value);
|
||||
remove => ApiEventManager.RemoveEvent("tray-balloon-closed", GetHashCode(), _balloonClosed, value);
|
||||
}
|
||||
|
||||
private event Action _balloonClosed;
|
||||
|
||||
@@ -4,6 +4,8 @@ using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.Common;
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace ElectronNET.API;
|
||||
|
||||
@@ -30,26 +32,8 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action<bool> OnCrashed
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_crashed == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-crashed" + Id, (killed) =>
|
||||
{
|
||||
_crashed((bool)killed);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-crashed", Id);
|
||||
}
|
||||
_crashed += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_crashed -= value;
|
||||
|
||||
if (_crashed == null)
|
||||
BridgeConnector.Socket.Off("webContents-crashed" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-crashed", Id, _crashed, value, (args) => (bool)args);
|
||||
remove => ApiEventManager.RemoveEvent("webContents-crashed", Id, _crashed, value);
|
||||
}
|
||||
|
||||
private event Action<bool> _crashed;
|
||||
@@ -60,26 +44,8 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action OnDidFinishLoad
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_didFinishLoad == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-didFinishLoad" + Id, () =>
|
||||
{
|
||||
_didFinishLoad();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-didFinishLoad", Id);
|
||||
}
|
||||
_didFinishLoad += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_didFinishLoad -= value;
|
||||
|
||||
if (_didFinishLoad == null)
|
||||
BridgeConnector.Socket.Off("webContents-didFinishLoad" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-didFinishLoad", Id, _didFinishLoad, value);
|
||||
remove => ApiEventManager.RemoveEvent("webContents-didFinishLoad", Id, _didFinishLoad, value);
|
||||
}
|
||||
|
||||
private event Action _didFinishLoad;
|
||||
@@ -89,26 +55,8 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action<string> OnDidStartNavigation
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_didStartNavigation == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<string>("webContents-didStartNavigation" + Id, (url) =>
|
||||
{
|
||||
_didStartNavigation(url);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-didStartNavigation", Id);
|
||||
}
|
||||
_didStartNavigation += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_didStartNavigation -= value;
|
||||
|
||||
if (_didStartNavigation == null)
|
||||
BridgeConnector.Socket.Off("webContents-didStartNavigation" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-didStartNavigation", Id, _didStartNavigation, value);
|
||||
remove => ApiEventManager.RemoveEvent("webContents-didStartNavigation", Id, _didStartNavigation, value);
|
||||
}
|
||||
|
||||
private event Action<string> _didStartNavigation;
|
||||
@@ -119,26 +67,8 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action<OnDidNavigateInfo> OnDidNavigate
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_didNavigate == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<OnDidNavigateInfo>("webContents-didNavigate" + Id, (data) =>
|
||||
{
|
||||
_didNavigate(data);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-didNavigate", Id);
|
||||
}
|
||||
_didNavigate += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_didNavigate -= value;
|
||||
|
||||
if (_didNavigate == null)
|
||||
BridgeConnector.Socket.Off("webContents-didNavigate" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-didNavigate", Id, _didNavigate, value);
|
||||
remove => ApiEventManager.RemoveEvent("webContents-didNavigate", Id, _didNavigate, value);
|
||||
}
|
||||
|
||||
private event Action<OnDidNavigateInfo> _didNavigate;
|
||||
@@ -149,26 +79,8 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action<string> OnWillRedirect
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_willRedirect == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<string>("webContents-willRedirect" + Id, (url) =>
|
||||
{
|
||||
_willRedirect(url);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-willRedirect", Id);
|
||||
}
|
||||
_willRedirect += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_willRedirect -= value;
|
||||
|
||||
if (_willRedirect == null)
|
||||
BridgeConnector.Socket.Off("webContents-willRedirect" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-willRedirect", Id, _willRedirect, value);
|
||||
remove => ApiEventManager.RemoveEvent("webContents-willRedirect", Id, _willRedirect, value);
|
||||
}
|
||||
|
||||
private event Action<string> _willRedirect;
|
||||
@@ -178,56 +90,19 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action<string> OnDidRedirectNavigation
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_didRedirectNavigation == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-didRedirectNavigation" + Id, (url) =>
|
||||
{
|
||||
_didRedirectNavigation(url?.ToString());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-didRedirectNavigation", Id);
|
||||
}
|
||||
_didRedirectNavigation += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_didRedirectNavigation -= value;
|
||||
|
||||
if (_didRedirectNavigation == null)
|
||||
BridgeConnector.Socket.Off("webContents-didRedirectNavigation" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-didRedirectNavigation", Id, _didRedirectNavigation, value);
|
||||
remove => ApiEventManager.RemoveEvent("webContents-didRedirectNavigation", Id, _didRedirectNavigation, value);
|
||||
}
|
||||
|
||||
private event Action<string> _didRedirectNavigation;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This event is like OnDidFinishLoad but emitted when the load failed.
|
||||
/// </summary>
|
||||
public event Action<OnDidFailLoadInfo> OnDidFailLoad
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_didFailLoad == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-willRedirect" + Id, (data) =>
|
||||
{
|
||||
_didFailLoad(((JObject) data).ToObject<OnDidFailLoadInfo>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-willRedirect", Id);
|
||||
}
|
||||
_didFailLoad += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_didFailLoad -= value;
|
||||
|
||||
if (_didFailLoad == null)
|
||||
BridgeConnector.Socket.Off("webContents-willRedirect" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-didFailLoad", Id, _didFailLoad, value, (args) => ((JObject)args).ToObject<OnDidFailLoadInfo>());
|
||||
remove => ApiEventManager.RemoveEvent("webContents-didFailLoad", Id, _didFailLoad, value);
|
||||
}
|
||||
|
||||
private event Action<OnDidFailLoadInfo> _didFailLoad;
|
||||
@@ -237,27 +112,8 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action<InputEvent> InputEvent
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_inputEvent == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-input-event" + Id, (eventArgs) =>
|
||||
{
|
||||
var inputEvent = ((JObject)eventArgs).ToObject<InputEvent>();
|
||||
_inputEvent(inputEvent);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-input-event", Id);
|
||||
}
|
||||
_inputEvent += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_inputEvent -= value;
|
||||
|
||||
if (_inputEvent == null)
|
||||
BridgeConnector.Socket.Off("webContents-input-event" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-input-event", Id, _inputEvent, value, (args) => ((JObject)args).ToObject<InputEvent>());
|
||||
remove => ApiEventManager.RemoveEvent("webContents-input-event", Id, _inputEvent, value);
|
||||
}
|
||||
|
||||
private event Action<InputEvent> _inputEvent;
|
||||
@@ -267,26 +123,8 @@ public class WebContents
|
||||
/// </summary>
|
||||
public event Action OnDomReady
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_domReady == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-domReady" + Id, () =>
|
||||
{
|
||||
_domReady();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-domReady", Id);
|
||||
}
|
||||
_domReady += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_domReady -= value;
|
||||
|
||||
if (_domReady == null)
|
||||
BridgeConnector.Socket.Off("webContents-domReady" + Id);
|
||||
}
|
||||
add => ApiEventManager.AddEvent("webContents-domReady", Id, _domReady, value);
|
||||
remove => ApiEventManager.RemoveEvent("webContents-domReady", Id, _domReady, value);
|
||||
}
|
||||
|
||||
private event Action _domReady;
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace ElectronNET.API
|
||||
get => _isQuitOnWindowAllClosed;
|
||||
set
|
||||
{
|
||||
BridgeConnector.Socket.Emit("quit-app-window-all-closed-event", value);
|
||||
BridgeConnector.Socket.Emit("quit-app-window-all-closed", value);
|
||||
_isQuitOnWindowAllClosed = value;
|
||||
}
|
||||
}
|
||||
@@ -153,12 +153,7 @@ namespace ElectronNET.API
|
||||
options.X -= 7;
|
||||
}
|
||||
|
||||
var ownjsonSerializer = new JsonSerializer()
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
};
|
||||
await BridgeConnector.Socket.Emit("createBrowserWindow", JObject.FromObject(options, ownjsonSerializer), loadUrl).ConfigureAwait(false);
|
||||
await BridgeConnector.Socket.Emit("createBrowserWindow", JObject.FromObject(options, this._jsonSerializer), loadUrl).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return await taskCompletionSource.Task.ConfigureAwait(false);
|
||||
@@ -216,8 +211,7 @@ namespace ElectronNET.API
|
||||
private readonly JsonSerializer _jsonSerializer = new()
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
DefaultValueHandling = DefaultValueHandling.Ignore
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ using SocketIO = SocketIOClient.SocketIO;
|
||||
internal class SocketIoFacade
|
||||
{
|
||||
private readonly SocketIO _socket;
|
||||
private readonly object _lockObj = new object();
|
||||
|
||||
public SocketIoFacade(string uri)
|
||||
{
|
||||
@@ -54,53 +55,71 @@ internal class SocketIoFacade
|
||||
|
||||
public void On(string eventName, Action action)
|
||||
{
|
||||
_socket.On(eventName, _ =>
|
||||
lock (_lockObj)
|
||||
{
|
||||
Task.Run(action);
|
||||
});
|
||||
_socket.On(eventName, _ =>
|
||||
{
|
||||
Task.Run(action);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void On<T>(string eventName, Action<T> action)
|
||||
{
|
||||
_socket.On(eventName, response =>
|
||||
lock (_lockObj)
|
||||
{
|
||||
var value = response.GetValue<T>();
|
||||
Task.Run(() => action(value));
|
||||
});
|
||||
_socket.On(eventName, response =>
|
||||
{
|
||||
var value = response.GetValue<T>();
|
||||
Task.Run(() => action(value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Remove this method when SocketIoClient supports object deserialization
|
||||
public void On(string eventName, Action<object> action)
|
||||
{
|
||||
_socket.On(eventName, response =>
|
||||
lock (_lockObj)
|
||||
{
|
||||
var value = response.GetValue<object>();
|
||||
////Console.WriteLine($"Called Event {eventName} - data {value}");
|
||||
Task.Run(() => action(value));
|
||||
});
|
||||
_socket.On(eventName, response =>
|
||||
{
|
||||
var value = response.GetValue<object>();
|
||||
////Console.WriteLine($"Called Event {eventName} - data {value}");
|
||||
Task.Run(() => action(value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void Once(string eventName, Action action)
|
||||
{
|
||||
_socket.On(eventName, _ =>
|
||||
lock (_lockObj)
|
||||
{
|
||||
_socket.Off(eventName);
|
||||
Task.Run(action);
|
||||
});
|
||||
_socket.On(eventName, _ =>
|
||||
{
|
||||
_socket.Off(eventName);
|
||||
Task.Run(action);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void Once<T>(string eventName, Action<T> action)
|
||||
{
|
||||
_socket.On(eventName, (socketIoResponse) =>
|
||||
lock (_lockObj)
|
||||
{
|
||||
_socket.Off(eventName);
|
||||
Task.Run(() => action(socketIoResponse.GetValue<T>()));
|
||||
});
|
||||
_socket.On(eventName, (socketIoResponse) =>
|
||||
{
|
||||
_socket.Off(eventName);
|
||||
Task.Run(() => action(socketIoResponse.GetValue<T>()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void Off(string eventName)
|
||||
{
|
||||
_socket.Off(eventName);
|
||||
lock (_lockObj)
|
||||
{
|
||||
_socket.Off(eventName);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task Emit(string eventName, params object[] args)
|
||||
|
||||
99
src/ElectronNET.API/Common/ApiEventManager.cs
Normal file
99
src/ElectronNET.API/Common/ApiEventManager.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using ElectronNET.API;
|
||||
using ElectronNET.API.Entities;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace ElectronNET.Common;
|
||||
|
||||
internal static class ApiEventManager
|
||||
{
|
||||
internal static void AddEvent(string eventName, object id, Action callback, Action value, string suffix = "")
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
BridgeConnector.Socket.On(eventName + id, () => { callback(); });
|
||||
BridgeConnector.Socket.Emit($"register-{eventName}{suffix}", id);
|
||||
}
|
||||
callback += value;
|
||||
}
|
||||
|
||||
internal static void RemoveEvent(string eventName, object id, Action callback, Action value)
|
||||
{
|
||||
callback -= value;
|
||||
if (callback == null) BridgeConnector.Socket.Off(eventName + id);
|
||||
}
|
||||
|
||||
internal static void AddEvent<T>(string eventName, object id, Action<T> callback, Action<T> value, Func<object, T> converter, string suffix = "")
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
BridgeConnector.Socket.On(eventName + id, (args) =>
|
||||
{
|
||||
var converted = converter.Invoke(args);
|
||||
callback(converted);
|
||||
});
|
||||
BridgeConnector.Socket.Emit($"register-{eventName}{suffix}", id);
|
||||
}
|
||||
callback += value;
|
||||
}
|
||||
|
||||
internal static void AddEvent<T>(string eventName, object id, Action<T> callback, Action<T> value)
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<T>(eventName + id, (args) => callback(args));
|
||||
BridgeConnector.Socket.Emit($"register-{eventName}", id);
|
||||
}
|
||||
callback += value;
|
||||
}
|
||||
|
||||
internal static void RemoveEvent<T>(string eventName, object id, Action<T> callback, Action<T> value)
|
||||
{
|
||||
callback -= value;
|
||||
if (callback == null) BridgeConnector.Socket.Off(eventName + id);
|
||||
}
|
||||
|
||||
internal static void AddTrayEvent(string eventName, object id, Action<TrayClickEventArgs, Rectangle> callback, Action<TrayClickEventArgs, Rectangle> value)
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
BridgeConnector.Socket.On<dynamic>(eventName + id, (result) =>
|
||||
{
|
||||
var args = ((JArray)result).ToObject<object[]>();
|
||||
var trayClickEventArgs = ((JObject)args[0]).ToObject<TrayClickEventArgs>();
|
||||
var bounds = ((JObject)args[1]).ToObject<Rectangle>();
|
||||
callback(trayClickEventArgs, bounds);
|
||||
});
|
||||
BridgeConnector.Socket.Emit($"register-{eventName}", id);
|
||||
callback += value;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void RemoveTrayEvent(string eventName, object id, Action<TrayClickEventArgs, Rectangle> callback, Action<TrayClickEventArgs, Rectangle> value)
|
||||
{
|
||||
callback -= value;
|
||||
if (callback == null) BridgeConnector.Socket.Off(eventName + id);
|
||||
}
|
||||
|
||||
internal static void AddScreenEvent(string eventName, object id, Action<Display, string[]> callback, Action<Display, string[]> value)
|
||||
{
|
||||
if (callback == null)
|
||||
{
|
||||
BridgeConnector.Socket.On(eventName + id, (args) =>
|
||||
{
|
||||
var display = ((JArray)args).First.ToObject<Display>();
|
||||
var metrics = ((JArray)args).Last.ToObject<string[]>();
|
||||
callback(display, metrics);
|
||||
});
|
||||
BridgeConnector.Socket.Emit($"register-{eventName}", id);
|
||||
callback += value;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void RemoveScreenEvent(string eventName, object id, Action<Display, string[]> callback, Action<Display, string[]> value)
|
||||
{
|
||||
callback -= value;
|
||||
if (callback == null) BridgeConnector.Socket.Off(eventName + id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
namespace ElectronNET.Common
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Immutable;
|
||||
using ElectronNET.Runtime.Data;
|
||||
using ElectronNET.Runtime.Services;
|
||||
|
||||
public static class Extensions
|
||||
internal static class Extensions
|
||||
{
|
||||
public static bool IsUnpackaged(this StartupMethod method)
|
||||
{
|
||||
@@ -19,6 +18,38 @@
|
||||
}
|
||||
}
|
||||
|
||||
public static string LowerFirst(this string str)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(str))
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
if (str.Length == 1)
|
||||
{
|
||||
return str.ToLower();
|
||||
}
|
||||
|
||||
return char.ToLower(str[0]) + str.Substring(1);
|
||||
}
|
||||
|
||||
public static string StripAsync(this string str)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(str))
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
var pos = str.LastIndexOf("Async", StringComparison.Ordinal);
|
||||
|
||||
if (pos > 0)
|
||||
{
|
||||
return str.Substring(0, pos);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
public static bool IsReady(this LifetimeServiceBase service)
|
||||
{
|
||||
return service != null && service.State == LifetimeState.Ready;
|
||||
|
||||
43
src/ElectronNET.API/Converter/PageSizeConverter.cs
Normal file
43
src/ElectronNET.API/Converter/PageSizeConverter.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using ElectronNET.API.Entities;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
namespace ElectronNET.Converter;
|
||||
|
||||
public class PageSizeConverter : JsonConverter<PageSize>
|
||||
{
|
||||
public override PageSize ReadJson(JsonReader reader, Type objectType, PageSize existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
if (reader.TokenType == JsonToken.String)
|
||||
{
|
||||
return (string)reader.Value;
|
||||
}
|
||||
else if (reader.TokenType == JsonToken.StartObject)
|
||||
{
|
||||
return serializer.Deserialize<PageSize>(reader);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new JsonSerializationException("Invalid value for PageSize. Expected true, false, or an object.");
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, PageSize value, JsonSerializer serializer)
|
||||
{
|
||||
if (value is null)
|
||||
{
|
||||
writer.WriteUndefined();
|
||||
}
|
||||
|
||||
var str = (string)value;
|
||||
|
||||
if (str is not null)
|
||||
{
|
||||
writer.WriteValue(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
serializer.Serialize(writer, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
43
src/ElectronNET.API/Converter/TitleBarOverlayConverter.cs
Normal file
43
src/ElectronNET.API/Converter/TitleBarOverlayConverter.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using ElectronNET.API.Entities;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
namespace ElectronNET.Converter;
|
||||
|
||||
public class TitleBarOverlayConverter : JsonConverter<TitleBarOverlay>
|
||||
{
|
||||
public override TitleBarOverlay ReadJson(JsonReader reader, Type objectType, TitleBarOverlay existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
if (reader.TokenType == JsonToken.Boolean)
|
||||
{
|
||||
return (bool)reader.Value;
|
||||
}
|
||||
else if (reader.TokenType == JsonToken.StartObject)
|
||||
{
|
||||
return serializer.Deserialize<TitleBarOverlay>(reader);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new JsonSerializationException("Invalid value for TitleBarOverlay. Expected true, false, or an object.");
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, TitleBarOverlay value, JsonSerializer serializer)
|
||||
{
|
||||
if (value is null)
|
||||
{
|
||||
writer.WriteUndefined();
|
||||
return;
|
||||
}
|
||||
|
||||
var @bool = (bool?)value;
|
||||
if (@bool.HasValue)
|
||||
{
|
||||
writer.WriteValue(@bool.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
serializer.Serialize(writer, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- When this is enabled, the project will be switched from nuget packages to consuming the ElectronNet orchestration directly -->
|
||||
<ElectronNetDevMode>False</ElectronNetDevMode>
|
||||
<ElectronNetDevMode>true</ElectronNetDevMode>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\ElectronNET\build\ElectronNET.props" Condition="$(ElectronNetDevMode)" />
|
||||
@@ -15,7 +15,7 @@
|
||||
<IsPackable>false</IsPackable>
|
||||
<ImportNuGetBuildTasksPackTargetsFromSdk>false</ImportNuGetBuildTasksPackTargetsFromSdk>
|
||||
<PublishTrimmed>False</PublishTrimmed>
|
||||
<NuGetAudit>False</NuGetAudit>
|
||||
<NuGetAudit>false</NuGetAudit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="ElectronNetCommon">
|
||||
<PackageIcon>128.png</PackageIcon>
|
||||
@@ -33,7 +33,7 @@
|
||||
<ElectronSplashScreen></ElectronSplashScreen>
|
||||
<License>MIT</License>
|
||||
<TypeScriptModuleKind>commonjs</TypeScriptModuleKind>
|
||||
<ElectronSingleInstance>False</ElectronSingleInstance>
|
||||
<ElectronSingleInstance>false</ElectronSingleInstance>
|
||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
@@ -69,7 +69,7 @@
|
||||
<ProjectReference Include="..\ElectronNET.API\ElectronNET.API.csproj" Condition="$(ElectronNetDevMode)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ElectronNET.Core" Version="0.1.0" Condition="'$(ElectronNetDevMode)' != 'True'" />
|
||||
<PackageReference Include="ElectronNET.Core" Version="0.1.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="..\ElectronNET\build\ElectronNET.targets" Condition="$(ElectronNetDevMode)" />
|
||||
|
||||
@@ -18,45 +18,45 @@ module.exports = (socket, app) => {
|
||||
electronSocket.emit('app-window-all-closed' + appWindowAllClosedEventId);
|
||||
}
|
||||
});
|
||||
socket.on('quit-app-window-all-closed-event', (quit) => {
|
||||
socket.on('quit-app-window-all-closed', (quit) => {
|
||||
isQuitWindowAllClosed = quit;
|
||||
});
|
||||
socket.on('register-app-window-all-closed-event', (id) => {
|
||||
socket.on('register-app-window-all-closed', (id) => {
|
||||
appWindowAllClosedEventId = id;
|
||||
});
|
||||
socket.on('register-app-before-quit-event', (id) => {
|
||||
socket.on('register-app-before-quit', (id) => {
|
||||
app.on('before-quit', (event) => {
|
||||
event.preventDefault();
|
||||
electronSocket.emit('app-before-quit' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-will-quit-event', (id) => {
|
||||
socket.on('register-app-will-quit', (id) => {
|
||||
app.on('will-quit', (event) => {
|
||||
event.preventDefault();
|
||||
electronSocket.emit('app-will-quit' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-browser-window-blur-event', (id) => {
|
||||
socket.on('register-app-browser-window-blur', (id) => {
|
||||
app.on('browser-window-blur', () => {
|
||||
electronSocket.emit('app-browser-window-blur' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-browser-window-focus-event', (id) => {
|
||||
socket.on('register-app-browser-window-focus', (id) => {
|
||||
app.on('browser-window-focus', () => {
|
||||
electronSocket.emit('app-browser-window-focus' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-browser-window-created-event', (id) => {
|
||||
socket.on('register-app-browser-window-created', (id) => {
|
||||
app.on('browser-window-created', () => {
|
||||
electronSocket.emit('app-browser-window-created' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-web-contents-created-event', (id) => {
|
||||
socket.on('register-app-web-contents-created', (id) => {
|
||||
app.on('web-contents-created', () => {
|
||||
electronSocket.emit('app-web-contents-created' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-accessibility-support-changed-event', (id) => {
|
||||
socket.on('register-app-accessibility-support-changed', (id) => {
|
||||
app.on('accessibility-support-changed', (event, accessibilitySupportEnabled) => {
|
||||
electronSocket.emit('app-accessibility-support-changed' + id, accessibilitySupportEnabled);
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -21,15 +21,15 @@ export = (socket: Socket, app: Electron.App) => {
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('quit-app-window-all-closed-event', (quit) => {
|
||||
socket.on('quit-app-window-all-closed', (quit) => {
|
||||
isQuitWindowAllClosed = quit;
|
||||
});
|
||||
|
||||
socket.on('register-app-window-all-closed-event', (id) => {
|
||||
socket.on('register-app-window-all-closed', (id) => {
|
||||
appWindowAllClosedEventId = id;
|
||||
});
|
||||
|
||||
socket.on('register-app-before-quit-event', (id) => {
|
||||
socket.on('register-app-before-quit', (id) => {
|
||||
app.on('before-quit', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -37,7 +37,7 @@ export = (socket: Socket, app: Electron.App) => {
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-will-quit-event', (id) => {
|
||||
socket.on('register-app-will-quit', (id) => {
|
||||
app.on('will-quit', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -45,31 +45,31 @@ export = (socket: Socket, app: Electron.App) => {
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-browser-window-blur-event', (id) => {
|
||||
socket.on('register-app-browser-window-blur', (id) => {
|
||||
app.on('browser-window-blur', () => {
|
||||
electronSocket.emit('app-browser-window-blur' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-browser-window-focus-event', (id) => {
|
||||
socket.on('register-app-browser-window-focus', (id) => {
|
||||
app.on('browser-window-focus', () => {
|
||||
electronSocket.emit('app-browser-window-focus' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-browser-window-created-event', (id) => {
|
||||
socket.on('register-app-browser-window-created', (id) => {
|
||||
app.on('browser-window-created', () => {
|
||||
electronSocket.emit('app-browser-window-created' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-web-contents-created-event', (id) => {
|
||||
socket.on('register-app-web-contents-created', (id) => {
|
||||
app.on('web-contents-created', () => {
|
||||
electronSocket.emit('app-web-contents-created' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-accessibility-support-changed-event', (id) => {
|
||||
socket.on('register-app-accessibility-support-changed', (id) => {
|
||||
app.on('accessibility-support-changed', (event, accessibilitySupportEnabled) => {
|
||||
electronSocket.emit('app-accessibility-support-changed' + id, accessibilitySupportEnabled);
|
||||
});
|
||||
|
||||
@@ -3,32 +3,32 @@ const electron_updater_1 = require("electron-updater");
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-autoUpdater-error-event', (id) => {
|
||||
socket.on('register-autoUpdater-error', (id) => {
|
||||
electron_updater_1.autoUpdater.on('error', (error) => {
|
||||
electronSocket.emit('autoUpdater-error' + id, error.message);
|
||||
});
|
||||
});
|
||||
socket.on('register-autoUpdater-checking-for-update-event', (id) => {
|
||||
socket.on('register-autoUpdater-checking-for-update', (id) => {
|
||||
electron_updater_1.autoUpdater.on('checking-for-update', () => {
|
||||
electronSocket.emit('autoUpdater-checking-for-update' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-autoUpdater-update-available-event', (id) => {
|
||||
socket.on('register-autoUpdater-update-available', (id) => {
|
||||
electron_updater_1.autoUpdater.on('update-available', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-available' + id, updateInfo);
|
||||
});
|
||||
});
|
||||
socket.on('register-autoUpdater-update-not-available-event', (id) => {
|
||||
socket.on('register-autoUpdater-update-not-available', (id) => {
|
||||
electron_updater_1.autoUpdater.on('update-not-available', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-not-available' + id, updateInfo);
|
||||
});
|
||||
});
|
||||
socket.on('register-autoUpdater-download-progress-event', (id) => {
|
||||
socket.on('register-autoUpdater-download-progress', (id) => {
|
||||
electron_updater_1.autoUpdater.on('download-progress', (progressInfo) => {
|
||||
electronSocket.emit('autoUpdater-download-progress' + id, progressInfo);
|
||||
});
|
||||
});
|
||||
socket.on('register-autoUpdater-update-downloaded-event', (id) => {
|
||||
socket.on('register-autoUpdater-update-downloaded', (id) => {
|
||||
electron_updater_1.autoUpdater.on('update-downloaded', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-downloaded' + id, updateInfo);
|
||||
});
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"autoUpdater.js","sourceRoot":"","sources":["autoUpdater.ts"],"names":[],"mappings":";AACA,uDAA+C;AAC/C,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,kCAAkC,EAAE,CAAC,EAAE,EAAE,EAAE;QACjD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C,EAAE,CAAC,uBAAuB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QAC9C,MAAM,OAAO,GAAG,MAAM,8BAAW,CAAC,UAAU,EAAE,CAAC;QAC/C,cAAc,CAAC,IAAI,CAAC,+BAA+B,GAAG,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -5,37 +5,37 @@ let electronSocket;
|
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
|
||||
socket.on('register-autoUpdater-error-event', (id) => {
|
||||
socket.on('register-autoUpdater-error', (id) => {
|
||||
autoUpdater.on('error', (error) => {
|
||||
electronSocket.emit('autoUpdater-error' + id, error.message);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-autoUpdater-checking-for-update-event', (id) => {
|
||||
socket.on('register-autoUpdater-checking-for-update', (id) => {
|
||||
autoUpdater.on('checking-for-update', () => {
|
||||
electronSocket.emit('autoUpdater-checking-for-update' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-autoUpdater-update-available-event', (id) => {
|
||||
socket.on('register-autoUpdater-update-available', (id) => {
|
||||
autoUpdater.on('update-available', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-available' + id, updateInfo);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-autoUpdater-update-not-available-event', (id) => {
|
||||
socket.on('register-autoUpdater-update-not-available', (id) => {
|
||||
autoUpdater.on('update-not-available', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-not-available' + id, updateInfo);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-autoUpdater-download-progress-event', (id) => {
|
||||
socket.on('register-autoUpdater-download-progress', (id) => {
|
||||
autoUpdater.on('download-progress', (progressInfo) => {
|
||||
electronSocket.emit('autoUpdater-download-progress' + id, progressInfo);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-autoUpdater-update-downloaded-event', (id) => {
|
||||
socket.on('register-autoUpdater-update-downloaded', (id) => {
|
||||
autoUpdater.on('update-downloaded', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-downloaded' + id, updateInfo);
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ module.exports = (socket) => {
|
||||
socket.on('nativeTheme-themeSource', (themeSource) => {
|
||||
electron_1.nativeTheme.themeSource = themeSource;
|
||||
});
|
||||
socket.on('register-nativeTheme-updated-event', (id) => {
|
||||
socket.on('register-nativeTheme-updated', (id) => {
|
||||
electron_1.nativeTheme.on('updated', () => {
|
||||
electronSocket.emit('nativeTheme-updated' + id);
|
||||
});
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"nativeTheme.js","sourceRoot":"","sources":["nativeTheme.ts"],"names":[],"mappings":";AACA,uCAAuC;AACvC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QAC9C,MAAM,mBAAmB,GAAG,sBAAW,CAAC,mBAAmB,CAAC;QAE5D,cAAc,CAAC,IAAI,CAAC,2CAA2C,EAAE,mBAAmB,CAAC,CAAC;IAC1F,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACtD,MAAM,2BAA2B,GAAG,sBAAW,CAAC,2BAA2B,CAAC;QAE5E,cAAc,CAAC,IAAI,CAAC,mDAAmD,EAAE,2BAA2B,CAAC,CAAC;IAC1G,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QACvD,MAAM,4BAA4B,GAAG,sBAAW,CAAC,4BAA4B,CAAC;QAE9E,cAAc,CAAC,IAAI,CAAC,oDAAoD,EAAE,4BAA4B,CAAC,CAAC;IAC5G,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAA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CAAC,4BAA4B,CAAC;QAE9E,cAAc,CAAC,IAAI,CAAC,oDAAoD,EAAE,4BAA4B,CAAC,CAAC;IAC5G,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QAC1C,MAAM,WAAW,GAAG,sBAAW,CAAC,WAAW,CAAC;QAE5C,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,WAAW,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,WAAW,EAAE,EAAE;QACjD,sBAAW,CAAC,WAAW,GAAG,WAAW,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC7C,sBAAW,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;YAC3B,cAAc,CAAC,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -33,7 +33,7 @@ export = (socket: Socket) => {
|
||||
nativeTheme.themeSource = themeSource;
|
||||
});
|
||||
|
||||
socket.on('register-nativeTheme-updated-event', (id) => {
|
||||
socket.on('register-nativeTheme-updated', (id) => {
|
||||
nativeTheme.on('updated', () => {
|
||||
electronSocket.emit('nativeTheme-updated' + id);
|
||||
});
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"process.js","sourceRoot":"","sources":["process.ts"],"names":[],"mappings":";AACA,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC;QAC/B,cAAc,CAAC,IAAI,CA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M,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC;QAC/B,cAAc,CAAC,IAAI,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAA;AACN,CAAC,CAAC"}
|
||||
@@ -5,17 +5,17 @@ module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-screen-display-added', (id) => {
|
||||
electron_1.screen.on('display-added', (event, display) => {
|
||||
electronSocket.emit('screen-display-added-event' + id, display);
|
||||
electronSocket.emit('screen-display-added' + id, display);
|
||||
});
|
||||
});
|
||||
socket.on('register-screen-display-removed', (id) => {
|
||||
electron_1.screen.on('display-removed', (event, display) => {
|
||||
electronSocket.emit('screen-display-removed-event' + id, display);
|
||||
electronSocket.emit('screen-display-removed' + id, display);
|
||||
});
|
||||
});
|
||||
socket.on('register-screen-display-metrics-changed', (id) => {
|
||||
electron_1.screen.on('display-metrics-changed', (event, display, changedMetrics) => {
|
||||
electronSocket.emit('screen-display-metrics-changed-event' + id, [display, changedMetrics]);
|
||||
electronSocket.emit('screen-display-metrics-changed' + id, [display, changedMetrics]);
|
||||
});
|
||||
});
|
||||
socket.on('screen-getCursorScreenPoint', () => {
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"screen.js","sourceRoot":"","sources":["screen.ts"],"names":[],"mappings":";AACA,uCAAkC;AAClC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,+BAA+B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC9C,iBAAM,CAAC,EAAE,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC1C,cAAc,CAAC,IAAI,CAAC,4BAA4B,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAA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AAC,EAAE,CAAC,+BAA+B,EAAE,CAAC,KAAK,EAAE,EAAE;QACjD,MAAM,OAAO,GAAG,iBAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACrD,cAAc,CAAC,IAAI,CAAC,wCAAwC,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAC,SAAS,EAAE,EAAE;QACjD,MAAM,OAAO,GAAG,iBAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACrD,cAAc,CAAC,IAAI,CAAC,oCAAoC,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -7,19 +7,19 @@ export = (socket: Socket) => {
|
||||
|
||||
socket.on('register-screen-display-added', (id) => {
|
||||
screen.on('display-added', (event, display) => {
|
||||
electronSocket.emit('screen-display-added-event' + id, display);
|
||||
electronSocket.emit('screen-display-added' + id, display);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-screen-display-removed', (id) => {
|
||||
screen.on('display-removed', (event, display) => {
|
||||
electronSocket.emit('screen-display-removed-event' + id, display);
|
||||
electronSocket.emit('screen-display-removed' + id, display);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-screen-display-metrics-changed', (id) => {
|
||||
screen.on('display-metrics-changed', (event, display, changedMetrics) => {
|
||||
electronSocket.emit('screen-display-metrics-changed-event' + id, [display, changedMetrics]);
|
||||
electronSocket.emit('screen-display-metrics-changed' + id, [display, changedMetrics]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -7,42 +7,42 @@ module.exports = (socket) => {
|
||||
socket.on('register-tray-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('click', (event, bounds) => {
|
||||
electronSocket.emit('tray-click-event' + id, [event.__proto__, bounds]);
|
||||
electronSocket.emit('tray-click' + id, [event.__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-right-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('right-click', (event, bounds) => {
|
||||
electronSocket.emit('tray-right-click-event' + id, [event.__proto__, bounds]);
|
||||
electronSocket.emit('tray-right-click' + id, [event.__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-double-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('double-click', (event, bounds) => {
|
||||
electronSocket.emit('tray-double-click-event' + id, [event.__proto__, bounds]);
|
||||
electronSocket.emit('tray-double-click' + id, [event.__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-balloon-show', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-show', () => {
|
||||
electronSocket.emit('tray-balloon-show-event' + id);
|
||||
electronSocket.emit('tray-balloon-show' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-balloon-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-click', () => {
|
||||
electronSocket.emit('tray-balloon-click-event' + id);
|
||||
electronSocket.emit('tray-balloon-click' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-balloon-closed', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-closed', () => {
|
||||
electronSocket.emit('tray-balloon-closed-event' + id);
|
||||
electronSocket.emit('tray-balloon-closed' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -8,7 +8,7 @@ export = (socket: Socket) => {
|
||||
socket.on('register-tray-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('click', (event, bounds) => {
|
||||
electronSocket.emit('tray-click-event' + id, [(<any>event).__proto__, bounds]);
|
||||
electronSocket.emit('tray-click' + id, [(<any>event).__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -16,7 +16,7 @@ export = (socket: Socket) => {
|
||||
socket.on('register-tray-right-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('right-click', (event, bounds) => {
|
||||
electronSocket.emit('tray-right-click-event' + id, [(<any>event).__proto__, bounds]);
|
||||
electronSocket.emit('tray-right-click' + id, [(<any>event).__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -24,7 +24,7 @@ export = (socket: Socket) => {
|
||||
socket.on('register-tray-double-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('double-click', (event, bounds) => {
|
||||
electronSocket.emit('tray-double-click-event' + id, [(<any>event).__proto__, bounds]);
|
||||
electronSocket.emit('tray-double-click' + id, [(<any>event).__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -32,7 +32,7 @@ export = (socket: Socket) => {
|
||||
socket.on('register-tray-balloon-show', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-show', () => {
|
||||
electronSocket.emit('tray-balloon-show-event' + id);
|
||||
electronSocket.emit('tray-balloon-show' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -40,7 +40,7 @@ export = (socket: Socket) => {
|
||||
socket.on('register-tray-balloon-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-click', () => {
|
||||
electronSocket.emit('tray-balloon-click-event' + id);
|
||||
electronSocket.emit('tray-balloon-click' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -48,7 +48,7 @@ export = (socket: Socket) => {
|
||||
socket.on('register-tray-balloon-closed', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-closed', () => {
|
||||
electronSocket.emit('tray-balloon-closed-event' + id);
|
||||
electronSocket.emit('tray-balloon-closed' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -328,7 +328,7 @@ function startSocketApiBridge(port) {
|
||||
if (nativeTheme === undefined) nativeTheme = require('./api/nativeTheme')(socket);
|
||||
if (dock === undefined) dock = require('./api/dock')(socket);
|
||||
|
||||
socket.on('register-app-open-file-event', (id) => {
|
||||
socket.on('register-app-open-file', (id) => {
|
||||
global['electronsocket'] = socket;
|
||||
|
||||
app.on('open-file', (event, file) => {
|
||||
@@ -342,7 +342,7 @@ function startSocketApiBridge(port) {
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-app-open-url-event', (id) => {
|
||||
socket.on('register-app-open-url', (id) => {
|
||||
global['electronsocket'] = socket;
|
||||
|
||||
app.on('open-url', (event, url) => {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- When this is enabled, the project will be switched from nuget packages to consuming the ElectronNet orchestration directly -->
|
||||
<ElectronNetDevMode>False</ElectronNetDevMode>
|
||||
<ElectronNetDevMode>true</ElectronNetDevMode>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\ElectronNET\build\ElectronNET.props" Condition="$(ElectronNetDevMode)" />
|
||||
@@ -15,8 +15,8 @@
|
||||
<PropertyGroup>
|
||||
<IsPackable>false</IsPackable>
|
||||
<ImportNuGetBuildTasksPackTargetsFromSdk>false</ImportNuGetBuildTasksPackTargetsFromSdk>
|
||||
<PublishTrimmed>False</PublishTrimmed>
|
||||
<NuGetAudit>False</NuGetAudit>
|
||||
<PublishTrimmed>false</PublishTrimmed>
|
||||
<NuGetAudit>false</NuGetAudit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="ElectronNetCommon">
|
||||
<PackageIcon>128.png</PackageIcon>
|
||||
@@ -33,7 +33,7 @@
|
||||
<ElectronVersion>30.4.0</ElectronVersion>
|
||||
<ElectronSplashScreen>wwwroot\assets\img\about@2x.png</ElectronSplashScreen>
|
||||
<License>MIT</License>
|
||||
<ElectronSingleInstance>False</ElectronSingleInstance>
|
||||
<ElectronSingleInstance>false</ElectronSingleInstance>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<ElectronBuilderVersion>26.0</ElectronBuilderVersion>
|
||||
</PropertyGroup>
|
||||
@@ -71,8 +71,8 @@
|
||||
<ProjectReference Include="..\ElectronNET.AspNet\ElectronNET.AspNet.csproj" Condition="$(ElectronNetDevMode)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ElectronNET.Core" Version="0.1.0" Condition="'$(ElectronNetDevMode)' != 'True'" />
|
||||
<PackageReference Include="ElectronNET.Core.AspNet" Version="0.1.0" Condition="'$(ElectronNetDevMode)' != 'True'" />
|
||||
<PackageReference Include="ElectronNET.Core" Version="0.1.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||
<PackageReference Include="ElectronNET.Core.AspNet" Version="0.1.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.9.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
<section class="about-section play-along">
|
||||
<h2>Play Along</h2>
|
||||
<p>Use the demo snippets in an Electron app of your own. The <a href="https://github.com/electron/electron-quick-start">Electron Quick Start<span class="u-visible-to-screen-reader">(opens in new window)</span></a> app is a bare-bones setup that pairs with these demos. Follow the instructions here to get it going.
|
||||
To activate Electron.NET include the <a href="https://www.nuget.org/packages/ElectronNET.API/" target="_blank">ElectronNET.API NuGet package</a> in your ASP.NET Core app.
|
||||
To activate Electron.NET include the <a href="https://www.nuget.org/packages/ElectronNET.Core/" target="_blank">ElectronNET.API NuGet package</a> in your ASP.NET Core app.
|
||||
<p>
|
||||
<code class="language-bash">dotnet add package ElectronNET.API</code>
|
||||
<code class="language-bash">dotnet add package ElectronNET.Core</code>
|
||||
</p>
|
||||
|
||||
Then include the UseElectron WebHostBuilder-Extension into the Program.cs-file of your ASP.NET Core project.
|
||||
@@ -20,7 +20,7 @@
|
||||
{
|
||||
return WebHost.CreateDefaultBuilder(args)
|
||||
.UseElectron(args)
|
||||
.UseStartup<Startup>()
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
}</code>
|
||||
</pre>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
};
|
||||
var folderPath = await Electron.Dialog.ShowOpenDialogAsync(mainWindow, options);
|
||||
|
||||
var resultFromTypeScript = await Electron.HostHook.CallAsync<string>("create-excel-file", folderPath);
|
||||
var resultFromTypeScript = await Electron.HostHook.CallAsync<string>("create-excel-file", folderPath);
|
||||
Electron.IpcMain.Send(mainWindow, "excel-file-created", resultFromTypeScript);
|
||||
});</code>
|
||||
</pre>
|
||||
|
||||
Binary file not shown.
@@ -11,7 +11,6 @@
|
||||
<UsingTask TaskName="ElectronNET.Build.RemoveEnvironmentVariables"
|
||||
AssemblyFile="$(MSBuildThisFileDirectory)ElectronNET.Build.dll" />
|
||||
|
||||
|
||||
<!-- Adjust the properties of items in the ElectronHostHook folder (if present) -->
|
||||
|
||||
<ItemGroup>
|
||||
@@ -42,7 +41,7 @@
|
||||
|
||||
<!-- Create variables for our output paths -->
|
||||
<PropertyGroup>
|
||||
<ElectronSourceFilesPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..\xxxxElectronNET.Host'))</ElectronSourceFilesPath>
|
||||
<ElectronSourceFilesPath>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\..\ElectronNET.Host'))</ElectronSourceFilesPath>
|
||||
<ElectronSourceFilesPath Condition="!Exists($(ElectronSourceFilesPath))">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\.electron'))</ElectronSourceFilesPath>
|
||||
<ElectronDirName>.electron</ElectronDirName>
|
||||
<ElectronSplashScreenFileName Condition="'$(ElectronSplashScreen)' != ''">$([System.IO.Path]::GetFileName($(ElectronSplashScreen)))</ElectronSplashScreenFileName>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<PropertyGroup Condition="'$(ElectronExecutable)' == ''">
|
||||
<PropertyGroup Condition="'$(ElectronExecutable)' == ''">
|
||||
<WinPrefix>win</WinPrefix>
|
||||
<ElectronExecutable Condition="'$(RuntimeIdentifier.StartsWith($(WinPrefix)))' == 'true'">$(Title)</ElectronExecutable>
|
||||
<ElectronExecutable Condition="'$(RuntimeIdentifier.StartsWith($(WinPrefix)))' != 'true'">$(PackageId)</ElectronExecutable>
|
||||
<ElectronExecutable Condition="'$(RuntimeIdentifier.StartsWith($(WinPrefix)))' == 'true'">$(Title)</ElectronExecutable>
|
||||
<ElectronExecutable Condition="'$(RuntimeIdentifier.StartsWith($(WinPrefix)))' != 'true'">$(PackageId)</ElectronExecutable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<_IsMsAspNetProject>False</_IsMsAspNetProject>
|
||||
<_IsMsAspNetProject Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true'">True</_IsMsAspNetProject>
|
||||
<_IsMsAspNetProject Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true'">True</_IsMsAspNetProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user