Compare commits

...

43 Commits

Author SHA1 Message Date
Robert Muehsig
12b46a9a48 Update README.md 2018-02-19 22:32:44 +01:00
Robert Muehsig
20e2220a8c 0.0.9 2018-02-19 22:21:07 +01:00
Robert Muehsig
041e2942ff documentation 2018-02-19 22:07:07 +01:00
Robert Muehsig
98e9bcdcd7 Merge pull request #100 from ElectronNET/params
Params
2018-02-19 21:22:08 +01:00
Robert Muehsig
eee2a3e34d Update buildAll.sh 2018-02-14 20:58:06 +01:00
Robert Muehsig
3137d58ba8 Merge pull request #97 from JobGetabu/patch-1
Grammer Changes
2018-02-14 20:51:42 +01:00
Robert Muehsig
293980c0d1 test with quotes 2018-02-14 20:51:15 +01:00
Job Getabu
8420d282bb Grammer Changes
line 6 :)
2018-02-14 22:46:01 +03:00
Robert Muehsig
cbb7a5bc4a test 2018-02-12 21:38:18 +01:00
Robert Muehsig
2aba2a498e fix 2018-02-12 21:23:23 +01:00
Robert Muehsig
a2ab76d18d electron arch and co 2018-02-12 21:17:40 +01:00
Robert Muehsig
d01d82ffec custom target testing 2018-02-11 22:33:22 +01:00
Robert Muehsig
92087bc3c8 fix usage 2018-02-11 22:28:00 +01:00
Robert Muehsig
a1aaabd588 test target stuff 2018-02-11 22:24:12 +01:00
Robert Muehsig
e4d03eed39 build fix 2018-01-24 22:44:27 +01:00
Robert Muehsig
e1fa8990ef wip 2018-01-24 22:39:46 +01:00
Gregor Biswanger
331ebb3d7f update to the new electron version 2018-01-23 23:41:15 +01:00
Gregor Biswanger
c8aec57f31 Merge pull request #54 from danielmarbach/cancellation
App cancellation token
2018-01-23 23:04:21 +01:00
Robert Muehsig
27e57f7fa1 Merge pull request #60 from yoDon/master
Add list of Starter Kits to ReadMe
2018-01-18 18:04:35 +01:00
Robert Muehsig
25182f98bf Merge pull request #73 from z1c0/patch-1
Update README.md
2018-01-18 18:03:36 +01:00
Wolfgang Ziegler
2461bcbd72 Update README.md
Fixed typo
2017-12-07 09:05:06 +01:00
Don Alvarez
8315153064 Add link in Readme to underlying Electron issue preventing macOS builds from being produced on Windows machines 2017-11-24 16:26:14 -08:00
danielmarbach
fc5250468e App cancellation token 2017-11-20 21:27:03 +01:00
Don Alvarez
f059ba80b4 Add list of Starter Kits to ReadMe 2017-11-15 16:00:34 -08:00
Robert Muehsig
200f511940 https://github.com/ElectronNET/Electron.NET/issues/52 2017-11-16 00:05:37 +01:00
Robert Muehsig
1f83a8d7ab typo 2017-11-15 23:43:39 +01:00
Robert Muehsig
5c14e585cf fix https://github.com/ElectronNET/Electron.NET/issues/52 2017-11-15 23:42:15 +01:00
Robert Muehsig
d1b42fa007 fix for #51 2017-11-15 22:58:33 +01:00
Robert Muehsig
861477c24d Merge pull request #57 from ElectronNET/tebeco-run_dll_extension_using_cli
BuildAll sh/cmd changes
2017-11-14 22:52:20 +01:00
Robert Muehsig
8c91c17656 remove cd in sh 2017-11-14 22:45:09 +01:00
Robert Muehsig
652cc60f6b typooooo 2017-11-14 22:35:42 +01:00
Robert Muehsig
4ba247d77c hrm 2017-11-14 22:27:58 +01:00
Robert Muehsig
220b4b290d shell test 2017-11-14 22:23:19 +01:00
Robert Muehsig
4bccbdf61d test 2017-11-14 22:13:15 +01:00
Robert Muehsig
e9e723eeae Merge pull request #56 from tebeco/run_dll_extension_using_cli
fix: run CLI dll extension using dotnet cli
2017-11-14 22:08:05 +01:00
Robert Muehsig
e6cb429ecb changes 2017-11-14 22:06:33 +01:00
TeBeCo
5316e1e2b8 fix: run CLI dll extension usingn dotnet cli 2017-11-14 13:39:42 +01:00
Robert Muehsig
189c4df46e Merge pull request #53 from ckrausko/ckrausko-patch-1
Grammatical error
2017-11-13 13:36:42 +01:00
Cody Krauskopf
11fd7a74a4 Grammatical error
Fixed a grammatical error in the readme
2017-11-13 07:28:18 -05:00
Gregor Biswanger
8bbc951ed1 Update README.md 2017-11-10 03:25:28 +01:00
Gregor Biswanger
ca382bf605 implement PreventDefault function for stop quiting application 2017-11-10 03:11:13 +01:00
Gregor Biswanger
531446f38d update demo code 2017-11-10 02:12:13 +01:00
Gregor Biswanger
fdb026c7bd fix app quit event bugs 2017-11-10 01:48:06 +01:00
28 changed files with 923 additions and 464 deletions

View File

@@ -1,5 +1,21 @@
# not release
# 0.0.9
ElectronNET.API:
* Better Async handling - thanks @danielmarbach
ElectronNET.CLI:
* More options on the 'build' command, e.g. for a 32bit debug build with electron prune: build /target custom win7-x86;win32 /dotnet-configuration Debug /electron-arch ia32 /electron-params "--prune=true "
* .NET Core project is now build with Release configuration, but can be adjusted with the new params.
* Be aware: "Breaking" (but because of the alpha status of this project, we won't use SemVer)
# 0.0.8
This version was skipped because we unfortunatly released a pre version of this on NuGet.
# 0.0.7
ElectronNET.CLI:

File diff suppressed because it is too large Load Diff

View File

@@ -47,18 +47,21 @@ namespace ElectronNET.API
public Task<string[]> ShowOpenDialogAsync(BrowserWindow browserWindow, OpenDialogOptions options)
{
var taskCompletionSource = new TaskCompletionSource<string[]>();
string guid = Guid.NewGuid().ToString();
BridgeConnector.Socket.On("showOpenDialogComplete", (filePaths) =>
BridgeConnector.Socket.On("showOpenDialogComplete" + guid, (filePaths) =>
{
BridgeConnector.Socket.Off("showOpenDialogComplete");
BridgeConnector.Socket.Off("showOpenDialogComplete" + guid);
var result = ((JArray)filePaths).ToObject<string[]>();
taskCompletionSource.SetResult(result);
});
BridgeConnector.Socket.Emit("showOpenDialog",
JObject.FromObject(browserWindow, _jsonSerializer),
JObject.FromObject(options, _jsonSerializer));
BridgeConnector.Socket.Emit("showOpenDialog",
JObject.FromObject(browserWindow, _jsonSerializer),
JObject.FromObject(options, _jsonSerializer),
guid);
return taskCompletionSource.Task;
}
@@ -72,17 +75,19 @@ namespace ElectronNET.API
public Task<string> ShowSaveDialogAsync(BrowserWindow browserWindow, SaveDialogOptions options)
{
var taskCompletionSource = new TaskCompletionSource<string>();
string guid = Guid.NewGuid().ToString();
BridgeConnector.Socket.On("showSaveDialogComplete", (filename) =>
BridgeConnector.Socket.On("showSaveDialogComplete" + guid, (filename) =>
{
BridgeConnector.Socket.Off("showSaveDialogComplete");
BridgeConnector.Socket.Off("showSaveDialogComplete" + guid);
taskCompletionSource.SetResult(filename.ToString());
});
BridgeConnector.Socket.Emit("showSaveDialog",
JObject.FromObject(browserWindow, _jsonSerializer),
JObject.FromObject(options, _jsonSerializer));
JObject.FromObject(options, _jsonSerializer),
guid);
return taskCompletionSource.Task;
}
@@ -139,10 +144,11 @@ namespace ElectronNET.API
public Task<MessageBoxResult> ShowMessageBoxAsync(BrowserWindow browserWindow, MessageBoxOptions messageBoxOptions)
{
var taskCompletionSource = new TaskCompletionSource<MessageBoxResult>();
var guid = Guid.NewGuid().ToString();
BridgeConnector.Socket.On("showMessageBoxComplete", (args) =>
BridgeConnector.Socket.On("showMessageBoxComplete" + guid, (args) =>
{
BridgeConnector.Socket.Off("showMessageBoxComplete");
BridgeConnector.Socket.Off("showMessageBoxComplete" + guid);
var result = ((JArray)args);
@@ -156,12 +162,13 @@ namespace ElectronNET.API
if (browserWindow == null)
{
BridgeConnector.Socket.Emit("showMessageBox", JObject.FromObject(messageBoxOptions, _jsonSerializer));
BridgeConnector.Socket.Emit("showMessageBox", JObject.FromObject(messageBoxOptions, _jsonSerializer), guid);
} else
{
BridgeConnector.Socket.Emit("showMessageBox",
JObject.FromObject(browserWindow, _jsonSerializer),
JObject.FromObject(messageBoxOptions, _jsonSerializer));
JObject.FromObject(messageBoxOptions, _jsonSerializer),
guid);
}
return taskCompletionSource.Task;
@@ -205,16 +212,18 @@ namespace ElectronNET.API
public Task ShowCertificateTrustDialogAsync(BrowserWindow browserWindow, CertificateTrustDialogOptions options)
{
var taskCompletionSource = new TaskCompletionSource<object>();
string guid = Guid.NewGuid().ToString();
BridgeConnector.Socket.On("showCertificateTrustDialogComplete", () =>
BridgeConnector.Socket.On("showCertificateTrustDialogComplete" + guid, () =>
{
BridgeConnector.Socket.Off("showCertificateTrustDialogComplete");
BridgeConnector.Socket.Off("showCertificateTrustDialogComplete" + guid);
taskCompletionSource.SetResult(null);
});
BridgeConnector.Socket.Emit("showCertificateTrustDialog",
JObject.FromObject(browserWindow, _jsonSerializer),
JObject.FromObject(options, _jsonSerializer));
JObject.FromObject(options, _jsonSerializer),
guid);
return taskCompletionSource.Task;
}

View File

@@ -0,0 +1,16 @@
namespace ElectronNET.API
{
/// <summary>
///
/// </summary>
public sealed class QuitEventArgs
{
/// <summary>
/// Will prevent the default behaviour, which is terminating the application.
/// </summary>
public void PreventDefault()
{
Electron.App.PreventQuit();
}
}
}

View File

@@ -38,6 +38,23 @@ namespace ElectronNET.API
}
}
/// <summary>
/// Quit when all windows are closed. (Default is true)
/// </summary>
/// <value>
/// <c>true</c> if [quit window all closed]; otherwise, <c>false</c>.
/// </value>
public bool IsQuitOnWindowAllClosed
{
get { return _isQuitOnWindowAllClosed; }
set
{
BridgeConnector.Socket.Emit("quit-app-window-all-closed-event", value);
_isQuitOnWindowAllClosed = value;
}
}
private bool _isQuitOnWindowAllClosed = true;
/// <summary>
/// Gets the browser windows.
/// </summary>

View File

@@ -9,13 +9,12 @@ namespace ElectronNET.CLI.Commands.Actions
{
public struct GetTargetPlatformInformationResult
{
public string DesiredPlatform { get; set; }
public string NetCorePublishRid { get; set; }
public string ElectronPackerPlatform { get; set; }
}
public static GetTargetPlatformInformationResult Do(string desiredPlatform)
public static GetTargetPlatformInformationResult Do(string desiredPlatform, string specifiedPlatfromFromCustom)
{
string netCorePublishRid = string.Empty;
string electronPackerPlatform = string.Empty;
@@ -34,22 +33,24 @@ namespace ElectronNET.CLI.Commands.Actions
netCorePublishRid = "linux-x64";
electronPackerPlatform = "linux";
break;
case "custom":
var splittedSpecified = specifiedPlatfromFromCustom.Split(';');
netCorePublishRid = splittedSpecified[0];
electronPackerPlatform = splittedSpecified[1];
break;
default:
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
desiredPlatform = "win";
netCorePublishRid = "win-x64";
electronPackerPlatform = "win32";
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
desiredPlatform = "osx";
netCorePublishRid = "osx-x64";
electronPackerPlatform = "darwin";
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
desiredPlatform = "linux";
netCorePublishRid = "linux-x64";
electronPackerPlatform = "linux";
}
@@ -59,7 +60,6 @@ namespace ElectronNET.CLI.Commands.Actions
return new GetTargetPlatformInformationResult()
{
DesiredPlatform = desiredPlatform,
ElectronPackerPlatform = electronPackerPlatform,
NetCorePublishRid = netCorePublishRid
};

View File

@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using ElectronNET.CLI.Commands.Actions;
@@ -11,7 +13,14 @@ namespace ElectronNET.CLI.Commands
{
public const string COMMAND_NAME = "build";
public const string COMMAND_DESCRIPTION = "Build your Electron Application.";
public const string COMMAND_ARGUMENTS = "<Platform> to build (default is current OS, possible values are: win,osx,linux)";
public static string COMMAND_ARGUMENTS = "Needed: '/target' with params 'win/osx/linux' to build for a typical app or use 'custom' and specify .NET Core build config & electron build config" + Environment.NewLine +
" for custom target, check .NET Core RID Catalog and Electron build target/" + Environment.NewLine +
" e.g. '/target win' or '/target custom \"win7-x86;win32\"'" + Environment.NewLine +
"Optional: '/dotnet-configuration' with the desired .NET Core build config e.g. release or debug. Default = Release" + Environment.NewLine +
"Optional: '/electron-arch' to specify the resulting electron processor architecture (e.g. ia86 for x86 builds). Be aware to use the '/target custom' param as well!" + Environment.NewLine +
"Optional: '/electron-params' specify any other valid parameter, which will be routed to the electron-packager." + Environment.NewLine +
"Full example for a 32bit debug build with electron prune: build /target custom win7-x86;win32 /dotnet-configuration Debug /electron-arch ia32 /electron-params \"--prune=true \"";
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
private string[] _args;
@@ -21,20 +30,36 @@ namespace ElectronNET.CLI.Commands
_args = args;
}
private string _paramTarget = "target";
private string _paramDotNetConfig = "dotnet-configuration";
private string _paramElectronArch = "electron-arch";
private string _paramElectronParams = "electron-params";
public Task<bool> ExecuteAsync()
{
return Task.Run(() =>
{
Console.WriteLine("Build Electron Application...");
string desiredPlatform = "";
SimpleCommandLineParser parser = new SimpleCommandLineParser();
parser.Parse(_args);
if (_args.Length > 0)
var desiredPlatform = parser.Arguments[_paramTarget][0];
string specifiedFromCustom = string.Empty;
if (desiredPlatform == "custom" && parser.Arguments[_paramTarget].Length > 1)
{
desiredPlatform = _args[0];
specifiedFromCustom = parser.Arguments["target"][1];
}
var platformInfo = GetTargetPlatformInformation.Do(desiredPlatform);
string configuration = "Release";
if (parser.Arguments.ContainsKey(_paramDotNetConfig))
{
configuration = parser.Arguments[_paramDotNetConfig][0];
}
var platformInfo = GetTargetPlatformInformation.Do(desiredPlatform, specifiedFromCustom);
Console.WriteLine($"Build ASP.NET Core App for {platformInfo.NetCorePublishRid}...");
string tempPath = Path.Combine(Directory.GetCurrentDirectory(), "obj", "desktop", desiredPlatform);
@@ -47,27 +72,44 @@ namespace ElectronNET.CLI.Commands
string tempBinPath = Path.Combine(tempPath, "bin");
Console.WriteLine($"Build ASP.NET Core App for {platformInfo.NetCorePublishRid}...");
Console.WriteLine($"Build ASP.NET Core App for {platformInfo.NetCorePublishRid} under {configuration}-Configuration...");
ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\"", Directory.GetCurrentDirectory());
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} -c {configuration} --output \"{tempBinPath}\"", Directory.GetCurrentDirectory());
if (resultCode != 0)
{
Console.WriteLine("Error occurred during dotnet publish.");
return false;
}
DeployEmbeddedElectronFiles.Do(tempPath);
Console.WriteLine("Start npm install...");
ProcessHelper.CmdExecute("npm install", tempPath);
var checkForNodeModulesDirPath = Path.Combine(tempPath, "node_modules");
Console.WriteLine("Start npm install electron-packager...");
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
if (Directory.Exists(checkForNodeModulesDirPath) == false)
{
// Works proper on Windows...
ProcessHelper.CmdExecute("npm install electron-packager --global", tempPath);
Console.WriteLine("node_modules missing in: " + checkForNodeModulesDirPath);
Console.WriteLine("Start npm install...");
ProcessHelper.CmdExecute("npm install", tempPath);
Console.WriteLine("Start npm install electron-packager...");
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// Works proper on Windows...
ProcessHelper.CmdExecute("npm install electron-packager --global", tempPath);
}
else
{
// ToDo: find another solution or document it proper
// GH Issue https://github.com/electron-userland/electron-prebuilt/issues/48
Console.WriteLine("Electron Packager - make sure you invoke 'sudo npm install electron-packager --global' at " + tempPath + " manually. Sry.");
}
}
else
{
// ToDo: find another solution or document it proper
// GH Issue https://github.com/electron-userland/electron-prebuilt/issues/48
Console.WriteLine("Electron Packager - make sure you invoke 'sudo npm install electron-packager --global' at " + tempPath + " manually. Sry.");
Console.WriteLine("Skip npm install, because node_modules directory exists in: " + checkForNodeModulesDirPath);
}
Console.WriteLine("Build Electron Desktop Application...");
@@ -76,8 +118,21 @@ namespace ElectronNET.CLI.Commands
Console.WriteLine("Executing electron magic in this directory: " + buildPath);
// ToDo: Need a solution for --asar support
string electronArch = "x64";
if (parser.Arguments.ContainsKey(_paramElectronArch))
{
electronArch = parser.Arguments[_paramElectronArch][0];
}
string electronParams = "";
if (parser.Arguments.ContainsKey(_paramElectronParams))
{
electronParams = parser.Arguments[_paramElectronParams][0];
}
Console.WriteLine($"Package Electron App for Platform {platformInfo.ElectronPackerPlatform}...");
ProcessHelper.CmdExecute($"electron-packager . --platform={platformInfo.ElectronPackerPlatform} --arch=x64 --out=\"{buildPath}\" --overwrite", tempPath);
ProcessHelper.CmdExecute($"electron-packager . --platform={platformInfo.ElectronPackerPlatform} --arch={electronArch} {electronParams} --out=\"{buildPath}\" --overwrite", tempPath);
Console.WriteLine("... done");

View File

@@ -48,10 +48,16 @@ namespace ElectronNET.CLI.Commands
Directory.CreateDirectory(tempPath);
}
var platformInfo = GetTargetPlatformInformation.Do(string.Empty);
var platformInfo = GetTargetPlatformInformation.Do(String.Empty, String.Empty);
string tempBinPath = Path.Combine(tempPath, "bin");
ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\"", aspCoreProjectPath);
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\"", aspCoreProjectPath);
if (resultCode != 0)
{
Console.WriteLine("Error occurred during dotnet publish.");
return false;
}
DeployEmbeddedElectronFiles.Do(tempPath);

View File

@@ -6,7 +6,7 @@ namespace ElectronNET.CLI
{
public class ProcessHelper
{
public static void CmdExecute(string command, string workingDirectoryPath, bool output = true, bool waitForExit = true)
public static int CmdExecute(string command, string workingDirectoryPath, bool output = true, bool waitForExit = true)
{
using (Process cmd = new Process())
{
@@ -28,10 +28,50 @@ namespace ElectronNET.CLI
cmd.StartInfo.CreateNoWindow = true;
cmd.StartInfo.UseShellExecute = false;
cmd.StartInfo.WorkingDirectory = workingDirectoryPath;
int returnCode = 0;
if (output)
{
cmd.OutputDataReceived += (s, e) => Console.WriteLine(e.Data);
cmd.ErrorDataReceived += (s, e) => Console.WriteLine(e.Data);
cmd.OutputDataReceived += (s, e) =>
{
// (sometimes error messages are only visbile here)
// poor mans solution, we just seek for the term 'error'
// we can't just use cmd.ExitCode, because
// we delegate it to cmd.exe, which runs fine
// but we can catch any error here and return
// 1 if something fails
if (e != null && string.IsNullOrWhiteSpace(e.Data) == false)
{
if (e.Data.ToLowerInvariant().Contains("error"))
{
returnCode = 1;
}
Console.WriteLine(e.Data);
}
};
cmd.ErrorDataReceived += (s, e) =>
{
// poor mans solution, we just seek for the term 'error'
// we can't just use cmd.ExitCode, because
// we delegate it to cmd.exe, which runs fine
// but we can catch any error here and return
// 1 if something fails
if (e != null && string.IsNullOrWhiteSpace(e.Data) == false)
{
if (e.Data.ToLowerInvariant().Contains("error"))
{
returnCode = 1;
}
Console.WriteLine(e.Data);
}
};
}
cmd.Start();
@@ -46,6 +86,8 @@ namespace ElectronNET.CLI
{
cmd.WaitForExit();
}
return returnCode;
}
}
}

View File

@@ -7,7 +7,6 @@ using System.Text;
namespace ElectronNET.CLI
{
class Program
{
static void Main(string[] args)

View File

@@ -0,0 +1,38 @@
using System.Collections.Generic;
namespace ElectronNET.CLI
{
public class SimpleCommandLineParser
{
public SimpleCommandLineParser()
{
Arguments = new Dictionary<string, string[]>();
}
public IDictionary<string, string[]> Arguments { get; private set; }
public void Parse(string[] args)
{
var currentName = "";
var values = new List<string>();
foreach (var arg in args)
{
if (arg.StartsWith("/"))
{
if (currentName != "")
Arguments[currentName] = values.ToArray();
values.Clear();
currentName = arg.Substring(1);
}
else if (currentName == "")
Arguments[arg] = new string[0];
else
values.Add(arg);
}
if (currentName != "")
Arguments[currentName] = values.ToArray();
}
public bool Contains(string name)
{
return Arguments.ContainsKey(name);
}
}
}

View File

@@ -1,26 +1,36 @@
"use strict";
exports.__esModule = true;
var isQuitWindowAllClosed = true;
module.exports = function (socket, app) {
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin' &&
isQuitWindowAllClosed) {
app.quit();
}
});
socket.on('quit-app-window-all-closed-event', function (quit) {
isQuitWindowAllClosed = quit;
});
socket.on('register-app-window-all-closed-event', function (id) {
app.on('window-all-closed', function () {
socket.emit('app-window-all-closed' + id);
});
});
socket.on('register-app-before-quit-event', function (id) {
app.on('before-quit', function () {
app.on('before-quit', function (event) {
event.preventDefault();
socket.emit('app-before-quit' + id);
});
});
socket.on('register-app-will-quit-event', function (id) {
app.on('will-quit', function () {
app.on('will-quit', function (event) {
event.preventDefault();
socket.emit('app-will-quit' + id);
});
});
socket.on('register-app-quit-event', function (id) {
app.on('quit', function () {
socket.emit('app-quit' + id);
});
});
socket.on('register-app-browser-window-blur-event', function (id) {
app.on('browser-window-blur', function () {
socket.emit('app-browser-window-blur' + id);

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,22 @@
import { nativeImage as NativeImage } from 'electron';
let isQuitWindowAllClosed = true;
module.exports = (socket: SocketIO.Server, app: Electron.App) => {
// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin' &&
isQuitWindowAllClosed) {
app.quit();
}
});
socket.on('quit-app-window-all-closed-event', (quit) => {
isQuitWindowAllClosed = quit;
});
socket.on('register-app-window-all-closed-event', (id) => {
app.on('window-all-closed', () => {
socket.emit('app-window-all-closed' + id);
@@ -9,20 +24,18 @@ module.exports = (socket: SocketIO.Server, app: Electron.App) => {
});
socket.on('register-app-before-quit-event', (id) => {
app.on('before-quit', () => {
app.on('before-quit', (event) => {
event.preventDefault();
socket.emit('app-before-quit' + id);
});
});
socket.on('register-app-will-quit-event', (id) => {
app.on('will-quit', () => {
socket.emit('app-will-quit' + id);
});
});
app.on('will-quit', (event) => {
event.preventDefault();
socket.on('register-app-quit-event', (id) => {
app.on('quit', () => {
socket.emit('app-quit' + id);
socket.emit('app-will-quit' + id);
});
});
@@ -103,7 +116,7 @@ module.exports = (socket: SocketIO.Server, app: Electron.App) => {
// }
socket.on('appGetFileIcon', (path, options) => {
if(options) {
if (options) {
app.getFileIcon(path, options, (error, nativeImage) => {
socket.emit('appGetFileIconCompleted', [error, nativeImage]);
});

View File

@@ -2,38 +2,40 @@
exports.__esModule = true;
var electron_1 = require("electron");
module.exports = function (socket) {
socket.on('showMessageBox', function (browserWindow, options) {
socket.on('showMessageBox', function (browserWindow, options, guid) {
if ("id" in browserWindow) {
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
electron_1.dialog.showMessageBox(window, options, function (response, checkboxChecked) {
socket.emit('showMessageBoxComplete', [response, checkboxChecked]);
socket.emit('showMessageBoxComplete' + guid, [response, checkboxChecked]);
});
}
else {
var message = browserWindow;
var id_1 = guid || options;
electron_1.dialog.showMessageBox(browserWindow, function (response, checkboxChecked) {
socket.emit('showMessageBoxComplete', [response, checkboxChecked]);
socket.emit('showMessageBoxComplete' + id_1, [response, checkboxChecked]);
});
}
});
socket.on('showOpenDialog', function (browserWindow, options) {
socket.on('showOpenDialog', function (browserWindow, options, guid) {
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
electron_1.dialog.showOpenDialog(window, options, function (filePaths) {
socket.emit('showOpenDialogComplete', filePaths || []);
socket.emit('showOpenDialogComplete' + guid, filePaths || []);
});
});
socket.on('showSaveDialog', function (browserWindow, options) {
socket.on('showSaveDialog', function (browserWindow, options, guid) {
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
electron_1.dialog.showSaveDialog(window, options, function (filename) {
socket.emit('showSaveDialogComplete', filename || '');
socket.emit('showSaveDialogComplete' + guid, filename || '');
});
});
socket.on('showErrorBox', function (title, content) {
electron_1.dialog.showErrorBox(title, content);
});
socket.on('showCertificateTrustDialog', function (browserWindow, options) {
socket.on('showCertificateTrustDialog', function (browserWindow, options, guid) {
var window = electron_1.BrowserWindow.fromId(browserWindow.id);
electron_1.dialog.showCertificateTrustDialog(window, options, function () {
socket.emit('showCertificateTrustDialogComplete');
socket.emit('showCertificateTrustDialogComplete' + guid);
});
});
};

View File

@@ -1 +1 @@
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["dialog.ts"],"names":[],"mappings":";;AAAA,qCAAiD;AAEjD,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAC,aAAa,EAAE,OAAO;QAC/C,EAAE,CAAC,CAAC,IAAI,IAAI,aAAa,CAAC,CAAC,CAAC;YACxB,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YAEpD,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,UAAC,QAAQ,EAAE,eAAe;gBAC7D,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;YACvE,CAAC,CAAC,CAAC;QACP,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,iBAAM,CAAC,cAAc,CAAC,aAAa,EAAE,UAAC,QAAQ,EAAE,eAAe;gBAC3D,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;YACvE,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAC,aAAa,EAAE,OAAO;QAC/C,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACpD,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,UAAC,SAAS;YAC7C,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAC,aAAa,EAAE,OAAO;QAC/C,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACpD,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,UAAC,QAAQ;YAC5C,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,OAAO;QACrC,iBAAM,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,UAAC,aAAa,EAAE,OAAO;QAC3D,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACpD,iBAAM,CAAC,0BAA0B,CAAC,MAAM,EAAE,OAAO,EAAE;YAC/C,MAAM,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["dialog.ts"],"names":[],"mappings":";;AAAA,qCAAiD;AAEjD,MAAM,CAAC,OAAO,GAAG,UAAC,MAAuB;IACrC,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAC,aAAa,EAAE,OAAO,EAAE,IAAI;QACrD,EAAE,CAAC,CAAC,IAAI,IAAI,aAAa,CAAC,CAAC,CAAC;YACxB,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YAEpD,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,UAAC,QAAQ,EAAE,eAAe;gBAC7D,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;YAC9E,CAAC,CAAC,CAAC;QACP,CAAC;QAAC,IAAI,CAAC,CAAC;YACJ,IAAI,OAAO,GAAG,aAAa,CAAC;YAC5B,IAAI,IAAE,GAAG,IAAI,IAAI,OAAO,CAAC;YACzB,iBAAM,CAAC,cAAc,CAAC,aAAa,EAAE,UAAC,QAAQ,EAAE,eAAe;gBAC3D,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAE,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;YAC5E,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAC,aAAa,EAAE,OAAO,EAAE,IAAI;QACrD,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACpD,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,UAAC,SAAS;YAC7C,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAC,aAAa,EAAE,OAAO,EAAE,IAAI;QACrD,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACpD,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,UAAC,QAAQ;YAC5C,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,UAAC,KAAK,EAAE,OAAO;QACrC,iBAAM,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,UAAC,aAAa,EAAE,OAAO,EAAE,IAAI;QACjE,IAAI,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACpD,iBAAM,CAAC,0BAA0B,CAAC,MAAM,EAAE,OAAO,EAAE;YAC/C,MAAM,CAAC,IAAI,CAAC,oCAAoC,GAAG,IAAI,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAA"}

View File

@@ -1,31 +1,33 @@
import { BrowserWindow, dialog } from "electron";
module.exports = (socket: SocketIO.Server) => {
socket.on('showMessageBox', (browserWindow, options) => {
socket.on('showMessageBox', (browserWindow, options, guid) => {
if ("id" in browserWindow) {
var window = BrowserWindow.fromId(browserWindow.id);
dialog.showMessageBox(window, options, (response, checkboxChecked) => {
socket.emit('showMessageBoxComplete', [response, checkboxChecked]);
socket.emit('showMessageBoxComplete' + guid, [response, checkboxChecked]);
});
} else {
var message = browserWindow;
let id = guid || options;
dialog.showMessageBox(browserWindow, (response, checkboxChecked) => {
socket.emit('showMessageBoxComplete', [response, checkboxChecked]);
socket.emit('showMessageBoxComplete' + id, [response, checkboxChecked]);
});
}
});
socket.on('showOpenDialog', (browserWindow, options) => {
socket.on('showOpenDialog', (browserWindow, options, guid) => {
var window = BrowserWindow.fromId(browserWindow.id);
dialog.showOpenDialog(window, options, (filePaths) => {
socket.emit('showOpenDialogComplete', filePaths || []);
socket.emit('showOpenDialogComplete' + guid, filePaths || []);
});
});
socket.on('showSaveDialog', (browserWindow, options) => {
socket.on('showSaveDialog', (browserWindow, options, guid) => {
var window = BrowserWindow.fromId(browserWindow.id);
dialog.showSaveDialog(window, options, (filename) => {
socket.emit('showSaveDialogComplete', filename || '');
socket.emit('showSaveDialogComplete' + guid, filename || '');
});
});
@@ -33,10 +35,10 @@ module.exports = (socket: SocketIO.Server) => {
dialog.showErrorBox(title, content);
});
socket.on('showCertificateTrustDialog', (browserWindow, options) => {
socket.on('showCertificateTrustDialog', (browserWindow, options, guid) => {
var window = BrowserWindow.fromId(browserWindow.id);
dialog.showCertificateTrustDialog(window, options, () => {
socket.emit('showCertificateTrustDialogComplete');
socket.emit('showCertificateTrustDialogComplete' + guid);
});
});
}

View File

@@ -58,15 +58,6 @@ function startAspCoreBackend(electronPort) {
});
}
// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
});
//app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.

View File

@@ -10,7 +10,7 @@
"integrity": "sha512-MOCVyzIwkBEloreoCVrTV108vSf8fFIJPsGruLCoAoBZdxtnJUqKA4lNonf/2u1twSjAspPEfmEheC+TLm/cMw==",
"dev": true,
"requires": {
"electron": "1.7.8"
"electron": "1.7.11"
}
},
"@types/node": {
@@ -47,14 +47,14 @@
"integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8="
},
"ajv": {
"version": "5.2.3",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.2.3.tgz",
"integrity": "sha1-wG9Zh3jETGsWGrr+NGa4GtGBTtI=",
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
"requires": {
"co": "4.6.0",
"fast-deep-equal": "1.0.0",
"json-schema-traverse": "0.3.1",
"json-stable-stringify": "1.0.1"
"fast-json-stable-stringify": "2.0.0",
"json-schema-traverse": "0.3.1"
}
},
"ansi-regex": {
@@ -348,13 +348,13 @@
}
},
"electron": {
"version": "1.7.8",
"resolved": "https://registry.npmjs.org/electron/-/electron-1.7.8.tgz",
"integrity": "sha1-J7eRpolRcafVKZG5lELNvRCjU50=",
"version": "1.7.11",
"resolved": "https://registry.npmjs.org/electron/-/electron-1.7.11.tgz",
"integrity": "sha1-mTtqp54OeafPzDafTIE/vZoLCNk=",
"requires": {
"@types/node": "7.0.43",
"electron-download": "3.3.0",
"extract-zip": "1.6.5"
"extract-zip": "1.6.6"
}
},
"electron-download": {
@@ -368,8 +368,8 @@
"minimist": "1.2.0",
"nugget": "2.0.1",
"path-exists": "2.1.0",
"rc": "1.2.1",
"semver": "5.4.1",
"rc": "1.2.4",
"semver": "5.5.0",
"sumchecker": "1.3.1"
}
},
@@ -426,9 +426,9 @@
}
},
"es6-promise": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.1.tgz",
"integrity": "sha512-OaU1hHjgJf+b0NzsxCg7NdIYERD6Hy/PEmFLTjw+b65scuisG3Kt4QoTvJ66BBkPZ581gr0kpoVzKnxniM8nng=="
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz",
"integrity": "sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ=="
},
"extend": {
"version": "3.0.1",
@@ -436,29 +436,14 @@
"integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ="
},
"extract-zip": {
"version": "1.6.5",
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.5.tgz",
"integrity": "sha1-maBnNbbqIOqbcF13ms/8yHz/BEA=",
"version": "1.6.6",
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.6.tgz",
"integrity": "sha1-EpDt6NINCHK0Kf0/NRyhKOxe+Fw=",
"requires": {
"concat-stream": "1.6.0",
"debug": "2.2.0",
"debug": "2.6.9",
"mkdirp": "0.5.0",
"yauzl": "2.4.1"
},
"dependencies": {
"debug": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
"integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=",
"requires": {
"ms": "0.7.1"
}
},
"ms": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
"integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg="
}
}
},
"extsprintf": {
@@ -471,6 +456,11 @@
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz",
"integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8="
},
"fast-json-stable-stringify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
},
"fd-slicer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz",
@@ -561,7 +551,7 @@
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
"integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=",
"requires": {
"ajv": "5.2.3",
"ajv": "5.5.2",
"har-schema": "2.0.0"
}
},
@@ -593,7 +583,7 @@
"boom": "4.3.1",
"cryptiles": "3.1.2",
"hoek": "4.2.0",
"sntp": "2.0.2"
"sntp": "2.1.0"
}
},
"hoek": {
@@ -649,9 +639,9 @@
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"ini": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz",
"integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4="
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw=="
},
"is-arrayish": {
"version": "0.2.1",
@@ -718,14 +708,6 @@
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A="
},
"json-stable-stringify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz",
"integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=",
"requires": {
"jsonify": "0.0.0"
}
},
"json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
@@ -739,11 +721,6 @@
"graceful-fs": "4.1.11"
}
},
"jsonify": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
"integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM="
},
"jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
@@ -864,7 +841,7 @@
"requires": {
"hosted-git-info": "2.5.0",
"is-builtin-module": "1.0.0",
"semver": "5.4.1",
"semver": "5.5.0",
"validate-npm-package-license": "3.0.1"
}
},
@@ -1024,12 +1001,12 @@
"integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A=="
},
"rc": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz",
"integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=",
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.4.tgz",
"integrity": "sha1-oPYGyq4qO4YrvQ74VILAElsxX6M=",
"requires": {
"deep-extend": "0.4.2",
"ini": "1.3.4",
"ini": "1.3.5",
"minimist": "1.2.0",
"strip-json-comments": "2.0.1"
}
@@ -1107,7 +1084,7 @@
"stringstream": "0.0.5",
"tough-cookie": "2.3.3",
"tunnel-agent": "0.6.0",
"uuid": "3.1.0"
"uuid": "3.2.1"
}
},
"rimraf": {
@@ -1124,9 +1101,9 @@
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
},
"semver": {
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz",
"integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg=="
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA=="
},
"signal-exit": {
"version": "3.0.2",
@@ -1142,9 +1119,9 @@
}
},
"sntp": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/sntp/-/sntp-2.0.2.tgz",
"integrity": "sha1-UGQRDwr4X3z9t9a2ekACjOUrSys=",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz",
"integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==",
"requires": {
"hoek": "4.2.0"
}
@@ -1243,11 +1220,6 @@
"tweetnacl": "0.14.5"
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
},
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
@@ -1258,6 +1230,11 @@
"strip-ansi": "3.0.1"
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
},
"stringstream": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
@@ -1298,7 +1275,7 @@
"integrity": "sha1-ebs7RFbdBPGOvbwNcDodHa7FEF0=",
"requires": {
"debug": "2.6.9",
"es6-promise": "4.1.1"
"es6-promise": "4.2.4"
}
},
"throttleit": {
@@ -1363,9 +1340,9 @@
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"uuid": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz",
"integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g=="
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz",
"integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA=="
},
"uws": {
"version": "0.14.5",

View File

@@ -11,7 +11,7 @@
"license": "ISC",
"dependencies": {
"detect-port": "^1.2.1",
"electron": "^1.7.8",
"electron": "^1.7.11",
"socket.io": "^2.0.3"
},
"devDependencies": {

View File

@@ -1,6 +1,7 @@
using ElectronNET.API;
using ElectronNET.API.Entities;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace ElectronNET.WebApp.Controllers
{
@@ -20,8 +21,7 @@ namespace ElectronNET.WebApp.Controllers
await Electron.Dialog.ShowMessageBoxAsync(options);
});
Electron.App.WillQuit += () => Electron.GlobalShortcut.UnregisterAll();
Electron.App.WillQuit += arg => Task.Run(() => Electron.GlobalShortcut.UnregisterAll());
}
return View();

View File

@@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
namespace ElectronNET.WebApp
{
@@ -61,7 +62,7 @@ namespace ElectronNET.WebApp
});
browserWindow.OnReadyToShow += () => browserWindow.Show();
browserWindow.SetTitle(Configuration["DemoTitleInSettings"] );
browserWindow.SetTitle(Configuration["DemoTitleInSettings"]);
}
}
}

View File

@@ -47,7 +47,7 @@
await Electron.Dialog.ShowMessageBoxAsync(options);
});
Electron.App.WillQuit += () => Electron.GlobalShortcut.UnregisterAll();</code></pre>
Electron.App.WillQuit += (args) => Task.Run(() => Electron.GlobalShortcut.UnregisterAll());</code></pre>
<div class="demo-protip">
<h2>ProTip</h2>

View File

@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2002
VisualStudioVersion = 15.0.27130.2024
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElectronNET.WebApp", "ElectronNET.WebApp\ElectronNET.WebApp.csproj", "{7C048379-401C-4345-B5E7-BE232DEA8157}"
EndProject
@@ -32,6 +32,8 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "ElectronNET.Host", "Electro
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2914CCF7-27C2-42AE-849A-2F0C1BC7CDFA}"
ProjectSection(SolutionItems) = preProject
buildAll.cmd = buildAll.cmd
buildAll.sh = buildAll.sh
buildReleaseNuGetPackages.cmd = buildReleaseNuGetPackages.cmd
EndProjectSection
EndProject

View File

@@ -3,19 +3,19 @@
AppVeyor (Win/Linux): [![Build status](https://ci.appveyor.com/api/projects/status/q95h4xt14papwi05/branch/master?svg=true)](https://ci.appveyor.com/project/robertmuehsig/electron-net/branch/master)
* Checkout AppVeyor Aritfacts: Contains the WebApp sample builded for Windows & Linux!
* Checkout AppVeyor Aritfacts: Contains the WebApp sample built for Windows & Linux!
Travis-CI (Win/macOS/Linux): [![Build Status](https://travis-ci.org/ElectronNET/Electron.NET.svg?branch=master)](https://travis-ci.org/ElectronNET/Electron.NET)
Build cross platform desktop apps with .NET Core 2.0 and ASP.NET NET Core.
Electron.NET is a __wrapper__ around a "normal" Electron application with a embedded ASP.NET Core application. Via our Electron.NET IPC bridge we can invoke Electron APIs from .NET.
Electron.NET is a __wrapper__ around a "normal" Electron application with an embedded ASP.NET Core application. Via our Electron.NET IPC bridge we can invoke Electron APIs from .NET.
The CLI extensions hosts our toolset to build and start Electron.NET applications.
## Wait - you host a .NET Core app inside Electron? Why?
Well... there are lots of different approaches how to get a X-plat desktop app running. We thought it would be nice for .NET devs to use the ASP.NET Core environment and just embed it inside a pretty robust X-plat enviroment called Electron. Porting Electron to .NET is not a goal of this project, at least we don't have any clue how do to it. We just combine ASP.NET Core & Electron.
Well... there are lots of different approaches how to get a X-plat desktop app running. We thought it would be nice for .NET devs to use the ASP.NET Core environment and just embed it inside a pretty robust X-plat enviroment called Electron. Porting Electron to .NET is not a goal of this project, at least we don't have any clue how to do it. We just combine ASP.NET Core & Electron.
# NuGet:
@@ -88,9 +88,11 @@ For the tooling you will need your dotnet-electronize package [ElectronNET.CLI N
```
<ItemGroup>
<DotNetCliToolReference Include="ElectronNET.CLI" Version="*" />
<DotNetCliToolReference Include="ElectronNET.CLI" Version="0.0.9" />
</ItemGroup>
```
Be aware of the version: The current version of the CLI is 0.0.9.
After you edited the .csproj-file, you need to restore your NuGet packages within your Project. Run the follwoing command in your ASP.NET Core folder:
```
@@ -123,8 +125,10 @@ Start your Electron.NET application with the Electron.NET CLI command. In Visual
## Usage of the Electron-API
A complete documentation will follow. Until then take a look in the source code of the sample application:
[Electron.NET API Demos](https://github.com/ElectronNET/electron.net-api-demos)
[Electron.NET API Demos](https://github.com/ElectronNET/electron.net-api-demos)
In this YouTube video, we show you how you can create a new project, use the Electron.NET API, debug a application and build an executable desktop app for Windows: [Electron.NET - Getting Started](https://www.youtube.com/watch?v=nuM6AojRFHk)
## Build
Here you need the Electron.NET CLI too. Type following command in your ASP.NET Core folder:
@@ -143,8 +147,12 @@ In your default setting we just build the application for the OS you are running
The end result should be an electron app under your __/bin/desktop__ folder.
## Starter kits
There is a React/Typescript/MobX starter kit at https://github.com/yoDon/Electron.NET-React-Typescript-MobX
### Note
> macOS builds on Windows are currently not supported, because the build just hangs, but I'm not sure why. The macOS builds works on Linux/macOS however.
> macOS builds can't be created on Windows machines because they require symlinks that aren't supported on Windows (per [this Electron issue](https://github.com/electron-userland/electron-packager/issues/71)). macOS builds can be produced on either Linux or macOS machines.
# Working with this Repo

View File

@@ -4,7 +4,7 @@ cd ElectronNet.API
dotnet restore
dotnet build
cd ..
echo "Restore & Build API"
echo "Restore & Build CLI"
cd ElectronNet.CLI
dotnet restore
dotnet build
@@ -13,14 +13,27 @@ echo "Restore & Build WebApp Demo"
cd ElectronNet.WebApp
dotnet restore
dotnet build
echo "Invoke electronize build in WebApp Demo"
echo "-- win"
dotnet electronize build win
echo "-- linux"
dotnet electronize build linux
echo "/target xxx (dev-build)"
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target custom win7-x86;win32 /dotnet-configuration Debug /electron-arch ia32 /electron-params "--prune=true "
REM Not supported on Windows Systems, because of SymLinks...
REM echo "-- osx"
REM dotnet electronize build osx
echo "/target win (dev-build)"
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target win
echo "/target linux (dev-build)"
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target linux
echo "/target custom win7-x86;win32 (dev-build)"
dotnet "../ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target custom win7-x86;win32
:: Be aware, that for non-electronnet-dev environments the correct
:: invoke command would be dotnet electronize ...
:: Not supported on Windows Systems, because of SymLinks...
:: echo "/target osx"
:: dotnet electronize build /target osx

View File

@@ -5,22 +5,30 @@ cd $dir/ElectronNET.API
dotnet restore
dotnet build
cd ..
echo "Restore & Build API"
echo "Restore & Build CLI"
cd $dir/ElectronNET.CLI
dotnet restore
dotnet build
cd ..
echo "Restore & Build WebApp Demo"
cd $dir/ElectronNET.WebApp
dotnet restore
dotnet build
echo "Invoke electronize build in WebApp Demo"
echo "-- win"
dotnet electronize build win
echo "/target win (dev-build)"
dotnet "$dir/ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target win
echo "-- linux"
dotnet electronize build linux
echo "/target linux (dev-build)"
dotnet "$dir/ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target linux
echo "-- osx"
dotnet electronize build osx
echo "/target osx (dev-build)"
dotnet "$dir/ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target osx
echo "/target custom win7-x86;win32 (dev-build)"
dotnet "$dir/ElectronNET.CLI/bin/Debug/netcoreapp2.0/dotnet-electronize.dll" build /target custom "win7-x86;win32"
# Be aware, that for non-electronnet-dev environments the correct
# invoke command would be dotnet electronize ...

View File

@@ -2,11 +2,11 @@ echo "Start building Electron.NET dev stack..."
echo "Restore & Build API"
cd ElectronNet.API
dotnet restore
dotnet build --configuration Release --force /property:Version=0.0.7
dotnet pack /p:Version=0.0.7 --configuration Release --force --output "%~dp0artifacts"
dotnet build --configuration Release --force /property:Version=0.0.9
dotnet pack /p:Version=0.0.9 --configuration Release --force --output "%~dp0artifacts"
cd ..
echo "Restore & Build API"
echo "Restore & Build CLI"
cd ElectronNet.CLI
dotnet restore
dotnet build --configuration Release --force /property:Version=0.0.7
dotnet pack /p:Version=0.0.7 --configuration Release --force --output "%~dp0artifacts"
dotnet build --configuration Release --force /property:Version=0.0.9
dotnet pack /p:Version=0.0.9 --configuration Release --force --output "%~dp0artifacts"