mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-09 02:07:47 +00:00
1.5 KiB
1.5 KiB
🛠 Requirements to Run
Our API uses .NET 6/8, so our
Also you should have installed:
- .NET 6/8 or later
- OS minimum base OS is the same as .NET 6 / .NET 8.
- NodeJS (at least Version 22.x)
👩🏫 Usage with ASP.Net
- Create a new ASP.Net Core project
- Install the following two nuget packages:
PM> Install-Package ElectronNET.Core
PM> Install-Package ElectronNET.Core.AspNet
Enable Electron.NET on Startup
To do so, use the UseElectron extension method on a WebApplicationBuilder, an IWebHostBuilder or any descendants.
Note
New in Electron.NET Core is that you provide a callback method as an argument to
UseElectron(), which ensures that you get to know the right moment to set up your application UI.
Program.cs
using ElectronNET.API;
using ElectronNET.API.Entities;
public static void Main(string[] args)
{
WebHost.CreateDefaultBuilder(args)
.UseElectron(args, ElectronAppReady)
.UseStartup<Startup>()
.Build()
.Run();
}
public static async Task ElectronAppReady()
{
var browserWindow = await Electron.WindowManager.CreateWindowAsync(
new BrowserWindowOptions { Show = false });
browserWindow.OnReadyToShow += () => browserWindow.Show();
}