diff --git a/src/ElectronNET.ConsoleApp/Assets/electron.ico b/src/ElectronNET.ConsoleApp/Assets/electron.ico new file mode 100644 index 0000000..3a10449 Binary files /dev/null and b/src/ElectronNET.ConsoleApp/Assets/electron.ico differ diff --git a/src/ElectronNET.ConsoleApp/Assets/electron_32x32.png b/src/ElectronNET.ConsoleApp/Assets/electron_32x32.png new file mode 100644 index 0000000..125dde6 Binary files /dev/null and b/src/ElectronNET.ConsoleApp/Assets/electron_32x32.png differ diff --git a/src/ElectronNET.ConsoleApp/ElectronNET.ConsoleApp.csproj b/src/ElectronNET.ConsoleApp/ElectronNET.ConsoleApp.csproj new file mode 100644 index 0000000..5c58a31 --- /dev/null +++ b/src/ElectronNET.ConsoleApp/ElectronNET.ConsoleApp.csproj @@ -0,0 +1,77 @@ + + + + + False + + + + + + net8.0 + exe + + + false + false + False + False + + + 128.png + app.ico + true + app.ico + ElectronNET API Demo1 + 1.0.2 + com.electronnet-apisamples.app + Electron.NET Demo Application + Electron.Net + Copyright © 2025, Electron.NET + Electron;.NET;ASP;NET;Sample;App + 30.4.0 + + MIT + commonjs + False + linux-x64 + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ElectronNET.ConsoleApp/Program.cs b/src/ElectronNET.ConsoleApp/Program.cs new file mode 100644 index 0000000..858473c --- /dev/null +++ b/src/ElectronNET.ConsoleApp/Program.cs @@ -0,0 +1,50 @@ +using ElectronNET.API; + +namespace ElectronNET.WebApp +{ + using System; + using System.Threading.Tasks; + using ElectronNET.API.Entities; + + public class Program + { + public static async Task Main(string[] args) + { + var runtimeController = ElectronNetRuntime.RuntimeController; + + try + { + await runtimeController.Start(); + + await runtimeController.WaitReadyTask; + + await ElectronBootstrap(); + + await runtimeController.WaitStoppedTask; + } + catch (Exception ex) + { + Console.WriteLine(ex); + await runtimeController.Stop().ConfigureAwait(false); + + await runtimeController.WaitStoppedTask.WaitAsync(TimeSpan.FromSeconds(2)).ConfigureAwait(false); + } + } + + public static async Task ElectronBootstrap() + { + //AddDevelopmentTests(); + + var browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions + { + Width = 1152, + Height = 940, + Show = false, + }, "https://github.com/ElectronNET/Electron.NET"); + + await browserWindow.WebContents.Session.ClearCacheAsync(); + + browserWindow.OnReadyToShow += () => browserWindow.Show(); + } + } +} diff --git a/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/linux-x64.pubxml b/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/linux-x64.pubxml new file mode 100644 index 0000000..c92d1b5 --- /dev/null +++ b/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/linux-x64.pubxml @@ -0,0 +1,15 @@ + + + + + Release + Any CPU + publish\Release\net8.0\linux-x64 + FileSystem + <_TargetId>Folder + net8.0 + linux-x64 + false + false + + \ No newline at end of file diff --git a/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/publish-win-x64.pubxml b/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/publish-win-x64.pubxml new file mode 100644 index 0000000..01940b3 --- /dev/null +++ b/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/publish-win-x64.pubxml @@ -0,0 +1,19 @@ + + + + + true + false + Release + Any CPU + FileSystem + publish\Release\net8.0\win-x64\ + FileSystem + <_TargetId>Folder + net8.0 + win-x64 + true + + \ No newline at end of file diff --git a/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/win-x64.pubxml b/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/win-x64.pubxml new file mode 100644 index 0000000..fbd2007 --- /dev/null +++ b/src/ElectronNET.ConsoleApp/Properties/PublishProfiles/win-x64.pubxml @@ -0,0 +1,16 @@ + + + + + Release + Any CPU + publish\Release\net8.0\win-x64 + FileSystem + <_TargetId>Folder + net8.0 + win-x64 + false + false + false + + \ No newline at end of file diff --git a/src/ElectronNET.ConsoleApp/Properties/electron-builder.json b/src/ElectronNET.ConsoleApp/Properties/electron-builder.json new file mode 100644 index 0000000..8130425 --- /dev/null +++ b/src/ElectronNET.ConsoleApp/Properties/electron-builder.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://raw.githubusercontent.com/electron-userland/electron-builder/refs/heads/master/packages/app-builder-lib/scheme.json", + "compression": "maximum", + //"afterPack": "bin/Assets/afterPack.js", + //"beforePack": "bin/Assets/beforePack.js", + "buildNumber": "", + "linux": { + "target": [ + "tar.xz" + //"AppImage", + //"rpm", + //"deb", + //"pacman" + ], + "executableArgs": [ "--no-sandbox" ], + "icon": "bin/Assets/icon.png", + "artifactName": "${name}-${arch}-${version}.${ext}" + }, + "win": { + "target": [ + { + "target": "portable", + "arch": "x64" + } + ], + "icon": "bin/Assets/icon.ico" + }, + "mac": { + "icon": "bin/Assets/icon.icns" + } +} diff --git a/src/ElectronNET.ConsoleApp/Properties/launchSettings.json b/src/ElectronNET.ConsoleApp/Properties/launchSettings.json new file mode 100644 index 0000000..5eed0b9 --- /dev/null +++ b/src/ElectronNET.ConsoleApp/Properties/launchSettings.json @@ -0,0 +1,30 @@ +{ + "profiles": { + "DotNet (unpackaged)": { + "commandName": "Project", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Electron (unpackaged)": { + "commandName": "Executable", + "executablePath": "node", + "commandLineArgs": "node_modules/electron/cli.js main.js -unpackedelectron", + "workingDirectory": "$(TargetDir).electron", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "WSL": { + "commandName": "WSL2", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development", + "ASPNETCORE_URLS": "http://localhost:8001/" + }, + "distributionName": "" + }, + "Profile 1": { + "commandName": "Project" + } + } +} \ No newline at end of file diff --git a/src/ElectronNET.ConsoleApp/app.ico b/src/ElectronNET.ConsoleApp/app.ico new file mode 100644 index 0000000..4127fe8 Binary files /dev/null and b/src/ElectronNET.ConsoleApp/app.ico differ