mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-09-21 06:25:20 +00:00
Improved template
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
}
|
||||
],
|
||||
"replaces": "net8.0",
|
||||
"defaultValue": "net8.0"
|
||||
"defaultValue": "net10.0"
|
||||
},
|
||||
"ElectronVersion": {
|
||||
"type": "parameter",
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user