Merge pull request #3 from ElectronNET/master

903
This commit is contained in:
Fre V
2020-07-06 15:59:12 +02:00
committed by GitHub
11 changed files with 69 additions and 23 deletions

View File

@@ -1,5 +1,7 @@
# Not released
# Released
# 9.31.1
ElectronNET.CLI:
@@ -10,7 +12,7 @@ ElectronNET.CLI:
ElectronNET.API:
* New Feature: Native Electron 9.0.1 support, but not all new features (we search contributors)
* New Feature: Native Electron 9.0.3 support, but not all new features (we search contributors)
* New Feature: PowerMonitor API Support (thanks [gustavo-lara-molina](https://github.com/gustavo-lara-molina)) [\#399](https://github.com/ElectronNET/Electron.NET/pull/399) [\#423](https://github.com/ElectronNET/Electron.NET/pull/423)
* New Feature: NativeTheme API Support (thanks [konstantingross](https://github.com/konstantingross)) [\#402](https://github.com/ElectronNET/Electron.NET/pull/402)
* New Feature: Cookie API Support (thanks [freosc](https://github.com/freosc)) [\#413](https://github.com/ElectronNET/Electron.NET/pull/413)
@@ -22,6 +24,7 @@ ElectronNET.API:
* Shell-Api Enhancement: API fixes for Electron 9.0.0 / Added missing parameters / Summaries rewritten (thanks [konstantingross](https://github.com/konstantingross)) [\#417](https://github.com/ElectronNET/Electron.NET/pull/417) [\#418](https://github.com/ElectronNET/Electron.NET/pull/418)
* Notification-Api Enhancement: Added missing properties in Notifications (thanks [konstantingross](https://github.com/konstantingross)) [\#410](https://github.com/ElectronNET/Electron.NET/pull/410)
* BrowserWindows-Api Enhancement: Add missing API call for SetProgressBar options (thanks [konstantingross](https://github.com/konstantingross)) [\#416](https://github.com/ElectronNET/Electron.NET/pull/416)
* BrowserWindow Enhancement: Add BrowserWindow.GetNativeWindowHandle() (thanks [kdlslyv](https://github.com/kdlslyv)) [\#429](https://github.com/ElectronNET/Electron.NET/pull/429)
* MacOS Enhancement: Application exit logic (thanks [dafergu2](https://github.com/dafergu2)) [\#405](https://github.com/ElectronNET/Electron.NET/pull/405)
* Fixed bug: ElectronNET.API.Entities.WebPreferences.ContextIsolation [DefaultValue(true)] [\#411](https://github.com/ElectronNET/Electron.NET/issues/411)
@@ -29,7 +32,7 @@ ElectronNET.WebApp (internal use):
* Improvement debugging and testing new API calls (without install ElectronNET.CLI) (thanks [konstantingross](https://github.com/konstantingross)) [\#425](https://github.com/ElectronNET/Electron.NET/pull/425)
* Fixed bug: Cannot find modules in ElectronHostHook (thanks [konstantingross](https://github.com/konstantingross)) [\#425](https://github.com/ElectronNET/Electron.NET/pull/425)
# Released
Thank you for donation [Phil Seeman](https://github.com/mpnow) ❤
# 8.31.2

View File

@@ -1809,6 +1809,25 @@ namespace ElectronNET.API
return taskCompletionSource.Task;
}
/// <summary>
/// Returns the native type of the handle is HWND on Windows, NSView* on macOS, and Window (unsigned long) on Linux.
/// </summary>
/// <returns>string of the native handle obtained, HWND on Windows, NSView* on macOS, and Window (unsigned long) on Linux.</returns>
public Task<string> GetNativeWindowHandle()
{
var taskCompletionSource = new TaskCompletionSource<string>();
BridgeConnector.Socket.On("browserWindow-getNativeWindowHandle-completed", (nativeWindowHandle) =>
{
BridgeConnector.Socket.Off("browserWindow-getNativeWindowHandle-completed");
taskCompletionSource.SetResult(nativeWindowHandle.ToString());
});
BridgeConnector.Socket.Emit("browserWindowGetNativeWindowHandle", Id);
return taskCompletionSource.Task;
}
/// <summary>
/// Sets the pathname of the file the window represents,
/// and the icon of the file will show in windows title bar.

View File

@@ -263,6 +263,15 @@ namespace ElectronNET.API
});
}
/// <summary>
/// Shows the Traybar (empty).
/// </summary>
/// <param name="image">The image.</param>
public void Show(string image)
{
BridgeConnector.Socket.Emit("create-tray", image);
}
/// <summary>
/// Destroys the tray icon immediately.
/// </summary>

View File

@@ -186,7 +186,7 @@ namespace ElectronNET.CLI.Commands
ProcessHelper.CmdExecute($"node build-helper.js " + manifestFileName, tempPath);
Console.WriteLine($"Package Electron App for Platform {platformInfo.ElectronPackerPlatform}...");
ProcessHelper.CmdExecute($"npx electron-builder . --config=./bin/electron-builder.json --{platformInfo.ElectronPackerPlatform} --{electronArch} -c.electronVersion=9.0.1 {electronParams}", tempPath);
ProcessHelper.CmdExecute($"npx electron-builder --config=./bin/electron-builder.json --{platformInfo.ElectronPackerPlatform} --{electronArch} -c.electronVersion=9.0.3 {electronParams}", tempPath);
Console.WriteLine("... done");

View File

@@ -435,6 +435,10 @@ module.exports = (socket, app) => {
const isKiosk = getWindowById(id).isKiosk();
electronSocket.emit('browserWindow-isKiosk-completed', isKiosk);
});
socket.on('browserWindowGetNativeWindowHandle', (id) => {
const nativeWindowHandle = getWindowById(id).getNativeWindowHandle().readInt32LE(0).toString(16);
electronSocket.emit('browserWindow-getNativeWindowHandle-completed', nativeWindowHandle);
});
socket.on('browserWindowSetRepresentedFilename', (id, filename) => {
getWindowById(id).setRepresentedFilename(filename);
});

File diff suppressed because one or more lines are too long

View File

@@ -553,6 +553,11 @@ export = (socket: SocketIO.Socket, app: Electron.App) => {
electronSocket.emit('browserWindow-isKiosk-completed', isKiosk);
});
socket.on('browserWindowGetNativeWindowHandle', (id) => {
const nativeWindowHandle = getWindowById(id).getNativeWindowHandle().readInt32LE(0).toString(16);
electronSocket.emit('browserWindow-getNativeWindowHandle-completed', nativeWindowHandle);
});
socket.on('browserWindowSetRepresentedFilename', (id, filename) => {
getWindowById(id).setRepresentedFilename(filename);
});

View File

@@ -47,13 +47,17 @@ module.exports = (socket) => {
}
});
socket.on('create-tray', (image, menuItems) => {
const menu = electron_1.Menu.buildFromTemplate(menuItems);
addMenuItemClickConnector(menu.items, (id) => {
electronSocket.emit('trayMenuItemClicked', id);
});
const trayIcon = electron_1.nativeImage.createFromPath(image);
tray = new electron_1.Tray(trayIcon);
tray.setContextMenu(menu);
if (menuItems) {
const menu = electron_1.Menu.buildFromTemplate(menuItems);
addMenuItemClickConnector(menu.items, (id) => {
electronSocket.emit('trayMenuItemClicked', id);
});
tray.setContextMenu(menu);
}
});
socket.on('tray-destroy', () => {
if (tray) {

View File

@@ -53,16 +53,18 @@ export = (socket: SocketIO.Socket) => {
});
socket.on('create-tray', (image, menuItems) => {
const menu = Menu.buildFromTemplate(menuItems);
addMenuItemClickConnector(menu.items, (id) => {
electronSocket.emit('trayMenuItemClicked', id);
});
const trayIcon = nativeImage.createFromPath(image);
tray = new Tray(trayIcon);
tray.setContextMenu(menu);
if (menuItems) {
const menu = Menu.buildFromTemplate(menuItems);
addMenuItemClickConnector(menu.items, (id) => {
electronSocket.emit('trayMenuItemClicked', id);
});
tray.setContextMenu(menu);
}
});
socket.on('tray-destroy', () => {

View File

@@ -437,9 +437,9 @@
"dev": true
},
"electron": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/electron/-/electron-9.0.1.tgz",
"integrity": "sha512-PZsQ0juL5YyDfOKES3HWz7zbWidcRcmtTzFCHSNzeVMjlkWB+hQToWVczFuGEWzwbAM1rCFs9MT0V/zpYT3pqQ==",
"version": "9.0.3",
"resolved": "https://registry.npmjs.org/electron/-/electron-9.0.3.tgz",
"integrity": "sha512-rY59wy50z0oWp/q69zq0UIzvtcM5j2BJbLAwEoLfVNS3DLt9wDZqRqSIBvLEBl+xWbafCnRA9haEqi7ssM94GA==",
"dev": true,
"requires": {
"@electron/get": "^1.0.1",
@@ -448,9 +448,9 @@
},
"dependencies": {
"@types/node": {
"version": "12.12.43",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.43.tgz",
"integrity": "sha512-KUyZdkGCnVPuXfsKmDUu2XLui65LZIJ2s0M57noy5e+ixUT2oK33ep7zlvgzI8LElcWqbf8AR+o/3GqAPac2zA==",
"version": "12.12.47",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.47.tgz",
"integrity": "sha512-yzBInQFhdY8kaZmqoL2+3U5dSTMrKaYcb561VU+lDzAYvqt+2lojvBEy+hmpSNuXnPTx7m9+04CzWYOUqWME2A==",
"dev": true
}
}

View File

@@ -21,7 +21,7 @@
"devDependencies": {
"@types/node": "^10.14.4",
"@types/socket.io": "^2.1.2",
"electron": "^9.0.1",
"electron": "^9.0.3",
"tslint": "^6.1.1",
"typescript": "^3.8.3"
}