Net8Blazor/NET8Blazor/PhotinoNetApp/Program.cs

35 lines
921 B
C#
Raw Normal View History

using System.Drawing;
using PhotinoNET;
using PhotinoNetAbpp.Components;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
builder.WebHost.UseWebRoot("wwwroot").UseStaticWebAssets();
builder.WebHost.UseUrls("http://localhost:5000");
var app = builder.Build();
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseAntiforgery();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
2024-01-24 18:22:13 +00:00
using var webServerCancellation = new CancellationTokenSource();
var webServerTask = app.RunAsync(webServerCancellation.Token);
var window = new PhotinoWindow()
.SetTitle("Test App")
.SetUseOsDefaultSize(false)
.SetSize(new Size(1024, 900))
.Center()
.SetResizable(true)
.Load("http://localhost:5000");
window.WaitForClose();
webServerCancellation.Cancel();
await webServerTask;