diff --git a/ElectronNET.API/BrowserWindow.cs b/ElectronNET.API/BrowserWindow.cs
index de023d0..77ccedf 100644
--- a/ElectronNET.API/BrowserWindow.cs
+++ b/ElectronNET.API/BrowserWindow.cs
@@ -156,7 +156,7 @@ namespace ElectronNET.API
{
if (_unresponsive == null)
{
- BridgeConnector.Socket.On("browserWindow-unresponsive", () =>
+ BridgeConnector.Socket.On("browserWindow-unresponsive" + Id, () =>
{
_unresponsive();
});
@@ -182,7 +182,7 @@ namespace ElectronNET.API
{
if (_responsive == null)
{
- BridgeConnector.Socket.On("browserWindow-responsive", () =>
+ BridgeConnector.Socket.On("browserWindow-responsive" + Id, () =>
{
_responsive();
});
@@ -807,6 +807,7 @@ namespace ElectronNET.API
internal BrowserWindow(int id) {
Id = id;
+ WebContents = new WebContents(id);
}
///
@@ -2148,6 +2149,11 @@ namespace ElectronNET.API
BridgeConnector.Socket.Emit("browserWindowSetVibrancy", Id, type.GetDescription());
}
+ ///
+ /// Render and control web pages.
+ ///
+ public WebContents WebContents { get; internal set; }
+
private JsonSerializer _jsonSerializer = new JsonSerializer()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
diff --git a/ElectronNET.API/Electron.cs b/ElectronNET.API/Electron.cs
index 6002677..6e42e27 100644
--- a/ElectronNET.API/Electron.cs
+++ b/ElectronNET.API/Electron.cs
@@ -36,5 +36,15 @@
/// Add icons and context menus to the system’s notification area.
///
public static Tray Tray { get { return Tray.Instance; } }
+
+ ///
+ /// Detect keyboard events when the application does not have keyboard focus.
+ ///
+ public static GlobalShortcut GlobalShortcut { get { return GlobalShortcut.Instance; } }
+
+ ///
+ /// Manage files and URLs using their default applications.
+ ///
+ public static Shell Shell { get { return Shell.Instance; } }
}
}
diff --git a/ElectronNET.API/Entities/DevToolsMode.cs b/ElectronNET.API/Entities/DevToolsMode.cs
new file mode 100644
index 0000000..b99af27
--- /dev/null
+++ b/ElectronNET.API/Entities/DevToolsMode.cs
@@ -0,0 +1,15 @@
+namespace ElectronNET.API.Entities
+{
+ ///
+ /// Opens the devtools with specified dock state, can be right, bottom, undocked,
+ /// detach.Defaults to last used dock state.In undocked mode it's possible to dock
+ /// back.In detach mode it's not.
+ ///
+ public enum DevToolsMode
+ {
+ right,
+ bottom,
+ undocked,
+ detach
+ }
+}
\ No newline at end of file
diff --git a/ElectronNET.API/Entities/Error.cs b/ElectronNET.API/Entities/Error.cs
new file mode 100644
index 0000000..69def9c
--- /dev/null
+++ b/ElectronNET.API/Entities/Error.cs
@@ -0,0 +1,7 @@
+namespace ElectronNET.API.Entities
+{
+ public class Error
+ {
+ public string Stack { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ElectronNET.API/Entities/OpenDevToolsOptions.cs b/ElectronNET.API/Entities/OpenDevToolsOptions.cs
new file mode 100644
index 0000000..ebb7d32
--- /dev/null
+++ b/ElectronNET.API/Entities/OpenDevToolsOptions.cs
@@ -0,0 +1,16 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+
+namespace ElectronNET.API.Entities
+{
+ public class OpenDevToolsOptions
+ {
+ ///
+ /// Opens the devtools with specified dock state, can be right, bottom, undocked,
+ /// detach.Defaults to last used dock state.In undocked mode it's possible to dock
+ /// back.In detach mode it's not.
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public DevToolsMode Mode { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ElectronNET.API/Entities/OpenExternalOptions.cs b/ElectronNET.API/Entities/OpenExternalOptions.cs
new file mode 100644
index 0000000..4ad12ff
--- /dev/null
+++ b/ElectronNET.API/Entities/OpenExternalOptions.cs
@@ -0,0 +1,13 @@
+using System.ComponentModel;
+
+namespace ElectronNET.API.Entities
+{
+ public class OpenExternalOptions
+ {
+ ///
+ /// true to bring the opened application to the foreground. The default is true.
+ ///
+ [DefaultValue(true)]
+ public bool Activate { get; set; } = true;
+ }
+}
\ No newline at end of file
diff --git a/ElectronNET.API/Entities/ShortcutDetails.cs b/ElectronNET.API/Entities/ShortcutDetails.cs
new file mode 100644
index 0000000..accc7ac
--- /dev/null
+++ b/ElectronNET.API/Entities/ShortcutDetails.cs
@@ -0,0 +1,41 @@
+namespace ElectronNET.API
+{
+ public class ShortcutDetails
+ {
+ ///
+ /// The Application User Model ID. Default is empty.
+ ///
+ public string AppUserModelId { get; set; }
+
+ ///
+ /// The arguments to be applied to target when launching from this shortcut. Default is empty.
+ ///
+ public string Args { get; set; }
+
+ ///
+ /// The working directory. Default is empty.
+ ///
+ public string Cwd { get; set; }
+
+ ///
+ /// The description of the shortcut. Default is empty.
+ ///
+ public string Description { get; set; }
+
+ ///
+ /// The path to the icon, can be a DLL or EXE. icon and iconIndex have to be set
+ /// together.Default is empty, which uses the target's icon.
+ ///
+ public string Icon { get; set; }
+
+ ///
+ /// The resource ID of icon when icon is a DLL or EXE. Default is 0.
+ ///
+ public int IconIndex { get; set; }
+
+ ///
+ /// The target to launch from this shortcut.
+ ///
+ public string Target { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ElectronNET.API/Entities/ShortcutLinkOperation.cs b/ElectronNET.API/Entities/ShortcutLinkOperation.cs
new file mode 100644
index 0000000..258c2bb
--- /dev/null
+++ b/ElectronNET.API/Entities/ShortcutLinkOperation.cs
@@ -0,0 +1,20 @@
+namespace ElectronNET.API
+{
+ public enum ShortcutLinkOperation
+ {
+ ///
+ /// Creates a new shortcut, overwriting if necessary.
+ ///
+ create,
+
+ ///
+ /// Updates specified properties only on an existing shortcut.
+ ///
+ update,
+
+ ///
+ /// Overwrites an existing shortcut, fails if the shortcut doesn’t exist.
+ ///
+ replace
+ }
+}
\ No newline at end of file
diff --git a/ElectronNET.API/GlobalShortcut.cs b/ElectronNET.API/GlobalShortcut.cs
new file mode 100644
index 0000000..a17668e
--- /dev/null
+++ b/ElectronNET.API/GlobalShortcut.cs
@@ -0,0 +1,98 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace ElectronNET.API
+{
+ ///
+ /// Detect keyboard events when the application does not have keyboard focus.
+ ///
+ public sealed class GlobalShortcut
+ {
+ private static GlobalShortcut _globalShortcut;
+
+ internal GlobalShortcut() { }
+
+ internal static GlobalShortcut Instance
+ {
+ get
+ {
+ if (_globalShortcut == null)
+ {
+ _globalShortcut = new GlobalShortcut();
+ }
+
+ return _globalShortcut;
+ }
+ }
+
+ private Dictionary _shortcuts = new Dictionary();
+
+ ///
+ /// Registers a global shortcut of accelerator.
+ /// The callback is called when the registered shortcut is pressed by the user.
+ ///
+ /// When the accelerator is already taken by other applications, this call will
+ /// silently fail.This behavior is intended by operating systems, since they don’t
+ /// want applications to fight for global shortcuts.
+ ///
+ public void Register(string accelerator, Action function)
+ {
+ if (!_shortcuts.ContainsKey(accelerator))
+ {
+ _shortcuts.Add(accelerator, function);
+
+ BridgeConnector.Socket.Off("globalShortcut-pressed");
+ BridgeConnector.Socket.On("globalShortcut-pressed", (shortcut) =>
+ {
+ if (_shortcuts.ContainsKey(shortcut.ToString()))
+ {
+ _shortcuts[shortcut.ToString()]();
+ }
+ });
+
+ BridgeConnector.Socket.Emit("globalShortcut-register", accelerator);
+ }
+ }
+
+ ///
+ /// When the accelerator is already taken by other applications,
+ /// this call will still return false. This behavior is intended by operating systems,
+ /// since they don’t want applications to fight for global shortcuts.
+ ///
+ /// Whether this application has registered accelerator.
+ public Task IsRegisteredAsync(string accelerator)
+ {
+ var taskCompletionSource = new TaskCompletionSource();
+
+ BridgeConnector.Socket.On("globalShortcut-isRegisteredCompleted", (isRegistered) =>
+ {
+ BridgeConnector.Socket.Off("globalShortcut-isRegisteredCompleted");
+
+ taskCompletionSource.SetResult((bool)isRegistered);
+ });
+
+ BridgeConnector.Socket.Emit("globalShortcut-isRegistered", accelerator);
+
+ return taskCompletionSource.Task;
+ }
+
+ ///
+ /// Unregisters the global shortcut of accelerator.
+ ///
+ public void Unregister(string accelerator)
+ {
+ _shortcuts.Remove(accelerator);
+ BridgeConnector.Socket.Emit("globalShortcut-unregister", accelerator);
+ }
+
+ ///
+ /// Unregisters all of the global shortcuts.
+ ///
+ public void UnregisterAll()
+ {
+ _shortcuts.Clear();
+ BridgeConnector.Socket.Emit("globalShortcut-unregisterAll");
+ }
+ }
+}
\ No newline at end of file
diff --git a/ElectronNET.API/IpcMain.cs b/ElectronNET.API/IpcMain.cs
index b0f56f9..48f9713 100644
--- a/ElectronNET.API/IpcMain.cs
+++ b/ElectronNET.API/IpcMain.cs
@@ -39,6 +39,25 @@ namespace ElectronNET.API
BridgeConnector.Socket.On(channel, listener);
}
+ ///
+ /// Send a message to the renderer process synchronously via channel,
+ /// you can also send arbitrary arguments.
+ ///
+ /// Note: Sending a synchronous message will block the whole renderer process,
+ /// unless you know what you are doing you should never use it.
+ ///
+ ///
+ ///
+ public void OnSync(string channel, Func