This commit is contained in:
Gregor Biswanger
2019-05-16 00:53:40 +02:00
6 changed files with 25 additions and 18 deletions

View File

@@ -1929,7 +1929,7 @@ namespace ElectronNET.API
public void SetMenu(MenuItem[] menuItems)
{
menuItems.AddMenuItemsId();
BridgeConnector.Socket.Emit("browserWindowSetMenu", JArray.FromObject(menuItems, _jsonSerializer));
BridgeConnector.Socket.Emit("browserWindowSetMenu", Id, JArray.FromObject(menuItems, _jsonSerializer));
_items.AddRange(menuItems);
BridgeConnector.Socket.Off("windowMenuItemClicked");
@@ -1950,7 +1950,7 @@ namespace ElectronNET.API
/// assumed.
/// </summary>
/// <param name="progress"></param>
public void SetProgressBar(int progress)
public void SetProgressBar(double progress)
{
BridgeConnector.Socket.Emit("browserWindowSetProgressBar", Id, progress);
}
@@ -1967,7 +1967,7 @@ namespace ElectronNET.API
/// </summary>
/// <param name="progress"></param>
/// <param name="progressBarOptions"></param>
public void SetProgressBar(int progress, ProgressBarOptions progressBarOptions)
public void SetProgressBar(double progress, ProgressBarOptions progressBarOptions)
{
BridgeConnector.Socket.Emit("browserWindowSetProgressBar", Id, progress, JObject.FromObject(progressBarOptions, _jsonSerializer));
}

View File

@@ -100,15 +100,16 @@ namespace ElectronNET.CLI.Commands
string launchSettingText = File.ReadAllText(launchSettingFile);
if (launchSettingText.Contains("electronize start") == false)
if (launchSettingText.Contains("\"executablePath\": \"electronize\"") == false)
{
StringBuilder debugProfileBuilder = new StringBuilder();
debugProfileBuilder.AppendLine("profiles\": {");
debugProfileBuilder.AppendLine("\"Electron.NET App\": {");
debugProfileBuilder.AppendLine("\"commandName\": \"Executable\",");
debugProfileBuilder.AppendLine("\"executablePath\": \"C:\\\\Program Files\\\\dotnet\\\\dotnet.exe\",");
debugProfileBuilder.AppendLine("\"commandLineArgs\": \"electronize start\"");
debugProfileBuilder.AppendLine("},");
debugProfileBuilder.AppendLine(" \"Electron.NET App\": {");
debugProfileBuilder.AppendLine(" \"commandName\": \"Executable\",");
debugProfileBuilder.AppendLine(" \"executablePath\": \"electronize\",");
debugProfileBuilder.AppendLine(" \"commandLineArgs\": \"start\",");
debugProfileBuilder.AppendLine(" \"workingDirectory\": \".\"");
debugProfileBuilder.AppendLine(" },");
launchSettingText = launchSettingText.Replace("profiles\": {", debugProfileBuilder.ToString());
File.WriteAllText(launchSettingFile, launchSettingText);

View File

@@ -1,11 +1,14 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
namespace ElectronNET.CLI
{
public class ProcessHelper
{
private readonly static Regex ErrorRegex = new Regex(@"\berror\b", RegexOptions.IgnoreCase | RegexOptions.Compiled);
public static int CmdExecute(string command, string workingDirectoryPath, bool output = true, bool waitForExit = true)
{
using (Process cmd = new Process())
@@ -44,7 +47,7 @@ namespace ElectronNET.CLI
// 1 if something fails
if (e != null && string.IsNullOrWhiteSpace(e.Data) == false)
{
if (e.Data.ToLowerInvariant().Contains("error"))
if (ErrorRegex.IsMatch(e.Data))
{
returnCode = 1;
}
@@ -63,7 +66,7 @@ namespace ElectronNET.CLI
// 1 if something fails
if (e != null && string.IsNullOrWhiteSpace(e.Data) == false)
{
if (e.Data.ToLowerInvariant().Contains("error"))
if (ErrorRegex.IsMatch(e.Data))
{
returnCode = 1;
}

View File

@@ -437,8 +437,8 @@ module.exports = (socket, app) => {
}
});
}
socket.on('browserWindowSetProgressBar', (id, progress) => {
getWindowById(id).setProgressBar(progress);
socket.on('browserWindowSetProgressBar', (id, progress, options) => {
getWindowById(id).setProgressBar(progress, options);
});
socket.on('browserWindowSetHasShadow', (id, hasShadow) => {
getWindowById(id).setHasShadow(hasShadow);

View File

@@ -8,6 +8,13 @@
}
},
"profiles": {
"Electron.NET App": {
"commandName": "Executable",
"executablePath": "electronize",
"commandLineArgs": "start",
"workingDirectory": "."
},
"IIS Express": {
"commandName": "IISExpress",
"environmentVariables": {
@@ -22,10 +29,5 @@
},
"applicationUrl": "http://localhost:50395/"
},
"Electron.NET App": {
"commandName": "Executable",
"executablePath": "C:\\Program Files\\dotnet\\dotnet.exe",
"commandLineArgs": "electronize start"
}
}
}

View File

@@ -10,3 +10,4 @@ cd ElectronNet.CLI
dotnet restore
dotnet build --configuration Release --force /property:Version=0.0.11
dotnet pack /p:Version=0.0.11 --configuration Release --force --output "%~dp0artifacts"
cd ..