using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using EnvelopeGenerator.WebUI.Client.Services; using EnvelopeGenerator.WebUI.Client.Options; using DevExpress.Blazor.Reporting; using DevExpress.XtraReports.Web.Extensions; using DevExpress.DataAccess.Web; using DevExpress.XtraReports.Services; var builder = WebAssemblyHostBuilder.CreateDefault(args); // HTTP Client (uses WebUI's YARP proxy) builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); // Configuration Options builder.Services.Configure(opts => builder.Configuration.GetSection(ApiOptions.SectionName).Bind(opts)); builder.Services.Configure(opts => builder.Configuration.GetSection(PdfViewerOptions.SectionName).Bind(opts)); // Business Services builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddSingleton(); // DevExpress WASM builder.Services.AddDevExpressWebAssemblyBlazorPdfViewer(); builder.Services.AddDevExpressWebAssemblyBlazorReportViewer(); builder.Services.AddDevExpressBlazorReportingWebAssembly(configure => { configure.UseDevelopmentMode(); }); // Reporting Services builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); DevExpress.Utils.DeserializationSettings.RegisterTrustedClass(typeof(EnvelopeGenerator.WebUI.Client.Data.DataItemList)); DevExpress.Utils.DeserializationSettings.RegisterTrustedClass(typeof(EnvelopeGenerator.WebUI.Client.PredefinedReports.Report)); builder.Services.AddSingleton(); builder.Services.AddSingleton(sp => sp.GetRequiredService()); builder.Services.AddScoped(); ReportStorageWebExtension.RegisterExtensionGlobal(new InMemoryReportStorageWebExtension()); var host = builder.Build(); await FontLoader.LoadFonts(host.Services.GetRequiredService(), new List { "opensans.ttf" }); await host.RunAsync();