Improved template

This commit is contained in:
Florian Rappl
2026-09-07 08:52:56 +02:00
parent 521e7c935a
commit 6d94cf9538
3 changed files with 18 additions and 1 deletions

View File

@@ -30,7 +30,7 @@
}
],
"replaces": "net8.0",
"defaultValue": "net8.0"
"defaultValue": "net10.0"
},
"ElectronVersion": {
"type": "parameter",

View File

@@ -5,7 +5,9 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
<ResourcePreloader />
<link rel="stylesheet" href="app.css" />
<ImportMap />
<title>ElectronBlazorApp</title>
<HeadOutlet />
</head>

View File

@@ -1,16 +1,30 @@
using ElectronNET.API;
using ElectronNET.API.Entities;
using ElectronNET.AspNet.Middleware;
using ElectronNET.AspNet.Services;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
builder.Services.AddSingleton<IElectronAuthenticationService, ElectronAuthenticationService>();
builder.Services.AddElectron();
// Starts the Electron shell and invokes ElectronAppReady once it is up.
builder.UseElectron(args, ElectronAppReady);
var app = builder.Build();
app.UseMiddleware<ElectronAuthenticationMiddleware>();
app.UseRouting();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
}
app.UseStaticFiles();
app.UseAntiforgery();
@@ -24,6 +38,7 @@ static async Task ElectronAppReady()
{
var window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
{
IsRunningBlazor = true,
Width = 1152,
Height = 940,
Show = false,