Integrate DevExpress and enhance app services
Added DevExpress WASM components for PDF and report viewing, including Blazor PDF Viewer and Report Viewer. Configured DevExpress Blazor Reporting for development mode and registered custom reporting services and trusted classes for deserialization. Replaced default `HttpClient` with a scoped service using WebUI's YARP proxy. Introduced configuration options for `ApiOptions` and `PdfViewerOptions` and registered multiple business services in the DI container. Added in-memory report storage and font loading functionality. Updated `_Imports.razor` with additional namespaces. Re-enabled and implemented previously commented-out configuration options and removed obsolete code.
This commit is contained in:
@@ -1,5 +1,55 @@
|
|||||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
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);
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||||
|
|
||||||
await builder.Build().RunAsync();
|
// HTTP Client (uses WebUI's YARP proxy)
|
||||||
|
builder.Services.AddScoped(sp => new HttpClient {
|
||||||
|
BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
|
||||||
|
});
|
||||||
|
|
||||||
|
// Configuration Options
|
||||||
|
builder.Services.Configure<ApiOptions>(opts =>
|
||||||
|
builder.Configuration.GetSection(ApiOptions.SectionName).Bind(opts));
|
||||||
|
builder.Services.Configure<PdfViewerOptions>(opts =>
|
||||||
|
builder.Configuration.GetSection(PdfViewerOptions.SectionName).Bind(opts));
|
||||||
|
|
||||||
|
// Business Services
|
||||||
|
builder.Services.AddScoped<DocumentService>();
|
||||||
|
builder.Services.AddScoped<AuthService>();
|
||||||
|
builder.Services.AddScoped<AnnotationService>();
|
||||||
|
builder.Services.AddScoped<EnvelopeReceiverService>();
|
||||||
|
builder.Services.AddScoped<SignatureService>();
|
||||||
|
builder.Services.AddScoped<SignatureCacheService>();
|
||||||
|
builder.Services.AddSingleton<AppVersionService>();
|
||||||
|
|
||||||
|
// DevExpress WASM
|
||||||
|
builder.Services.AddDevExpressWebAssemblyBlazorPdfViewer();
|
||||||
|
builder.Services.AddDevExpressWebAssemblyBlazorReportViewer();
|
||||||
|
|
||||||
|
builder.Services.AddDevExpressBlazorReportingWebAssembly(configure => {
|
||||||
|
configure.UseDevelopmentMode();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Reporting Services
|
||||||
|
builder.Services.AddScoped<IDataSourceWizardJsonConnectionStorage, CustomDataSourceWizardJsonDataConnectionStorage>();
|
||||||
|
builder.Services.AddScoped<IJsonDataConnectionProviderFactory, CustomJsonDataConnectionProviderFactory>();
|
||||||
|
builder.Services.AddScoped<IObjectDataSourceWizardTypeProvider, ObjectDataSourceWizardCustomTypeProvider>();
|
||||||
|
|
||||||
|
DevExpress.Utils.DeserializationSettings.RegisterTrustedClass(typeof(EnvelopeGenerator.WebUI.Client.Data.DataItemList));
|
||||||
|
DevExpress.Utils.DeserializationSettings.RegisterTrustedClass(typeof(EnvelopeGenerator.WebUI.Client.PredefinedReports.Report));
|
||||||
|
|
||||||
|
builder.Services.AddSingleton<InMemoryReportStorageWebExtension>();
|
||||||
|
builder.Services.AddSingleton<ReportStorageWebExtension>(sp => sp.GetRequiredService<InMemoryReportStorageWebExtension>());
|
||||||
|
builder.Services.AddScoped<IReportProviderAsync, CustomReportProvider>();
|
||||||
|
|
||||||
|
ReportStorageWebExtension.RegisterExtensionGlobal(new InMemoryReportStorageWebExtension());
|
||||||
|
|
||||||
|
var host = builder.Build();
|
||||||
|
await FontLoader.LoadFonts(host.Services.GetRequiredService<HttpClient>(), new List<string> { "opensans.ttf" });
|
||||||
|
await host.RunAsync();
|
||||||
|
|||||||
@@ -5,5 +5,12 @@
|
|||||||
@using Microsoft.AspNetCore.Components.Web
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
@using static Microsoft.AspNetCore.Components.Web.RenderMode
|
@using static Microsoft.AspNetCore.Components.Web.RenderMode
|
||||||
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
@using Microsoft.AspNetCore.Components.Web.Virtualization
|
||||||
|
@using Microsoft.AspNetCore.Components.WebAssembly.Http
|
||||||
@using Microsoft.JSInterop
|
@using Microsoft.JSInterop
|
||||||
@using EnvelopeGenerator.WebUI.Client
|
@using EnvelopeGenerator.WebUI.Client
|
||||||
|
@using EnvelopeGenerator.WebUI.Client.Services
|
||||||
|
@using EnvelopeGenerator.WebUI.Client.Models
|
||||||
|
@using EnvelopeGenerator.WebUI.Client.Options
|
||||||
|
@using DevExpress.Blazor
|
||||||
|
@using DevExpress.Blazor.PdfViewer
|
||||||
|
@using DevExpress.Blazor.Reporting
|
||||||
|
|||||||
@@ -18,13 +18,12 @@ builder.Services.AddReverseProxy()
|
|||||||
// DevExpress Server-Side Services (CRITICAL for DxPdfViewer)
|
// DevExpress Server-Side Services (CRITICAL for DxPdfViewer)
|
||||||
builder.Services.AddDevExpressBlazor(configure => configure.BootstrapVersion = BootstrapVersion.v5);
|
builder.Services.AddDevExpressBlazor(configure => configure.BootstrapVersion = BootstrapVersion.v5);
|
||||||
builder.Services.AddDevExpressServerSideBlazorPdfViewer();
|
builder.Services.AddDevExpressServerSideBlazorPdfViewer();
|
||||||
// builder.Services.AddDevExpressBlazorReportViewer(); // Will be enabled after Options migration
|
|
||||||
|
|
||||||
// Configuration Options (will be enabled in Phase 5 after Options migration)
|
// Configuration Options
|
||||||
// builder.Services.Configure<EnvelopeGenerator.WebUI.Client.Options.ApiOptions>(
|
builder.Services.Configure<EnvelopeGenerator.WebUI.Client.Options.ApiOptions>(
|
||||||
// builder.Configuration.GetSection("ApiOptions"));
|
builder.Configuration.GetSection("ApiOptions"));
|
||||||
// builder.Services.Configure<EnvelopeGenerator.WebUI.Client.Options.PdfViewerOptions>(
|
builder.Services.Configure<EnvelopeGenerator.WebUI.Client.Options.PdfViewerOptions>(
|
||||||
// builder.Configuration.GetSection("PdfViewerOptions"));
|
builder.Configuration.GetSection("PdfViewerOptions"));
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user