Initial commit
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using MudBlazor;
|
||||
using MudBlazor.Services;
|
||||
using RobotNet10.CustomConfigurationEditor.Services.API;
|
||||
using RobotNet10.CustomConfigurationEditor.Services.State;
|
||||
using RobotNet10.FleetManager.Client;
|
||||
using RobotNet10.FleetManager.Client.Services;
|
||||
using RobotNet10.MapEditor.Services.API;
|
||||
using RobotNet10.MapEditor.Services.State;
|
||||
using RobotNet10.ScriptEditor;
|
||||
using System.Globalization;
|
||||
|
||||
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
|
||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
|
||||
builder.Logging.AddFilter("System.Net.Http.HttpClient", LogLevel.Warning);
|
||||
builder.Services.AddAuthorizationCore();
|
||||
builder.Services.AddCascadingAuthenticationState();
|
||||
builder.Services.AddAuthenticationStateDeserialization();
|
||||
|
||||
builder.Services.AddNavigationMenu();
|
||||
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress), });
|
||||
builder.Services.AddMudServices(config =>
|
||||
{
|
||||
config.SnackbarConfiguration.VisibleStateDuration = 2000;
|
||||
config.SnackbarConfiguration.HideTransitionDuration = 500;
|
||||
config.SnackbarConfiguration.ShowTransitionDuration = 500;
|
||||
config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomLeft;
|
||||
});
|
||||
|
||||
// MapEditor Services
|
||||
builder.Services.AddScoped<MapManagerApiService>();
|
||||
builder.Services.AddScoped<LayoutManagerState>();
|
||||
builder.Services.AddScoped<LayoutEditorState>();
|
||||
builder.Services.AddScoped<VehicleTypeManagerState>();
|
||||
builder.Services.AddScoped<VehicleTypeEditState>();
|
||||
builder.Services.AddScoped<StationManagerState>();
|
||||
|
||||
// Robot Management Services
|
||||
builder.Services.AddScoped<RobotModelApiService>();
|
||||
builder.Services.AddScoped<RobotApiService>();
|
||||
|
||||
// SignalR Hub Client - Use factory to create per-scope instances
|
||||
builder.Services.AddScoped<RobotStateHubClient>(sp =>
|
||||
{
|
||||
var navigationManager = sp.GetRequiredService<NavigationManager>();
|
||||
var logger = sp.GetService<ILogger<RobotStateHubClient>>();
|
||||
return new RobotStateHubClient(navigationManager, logger);
|
||||
});
|
||||
|
||||
// Robot Monitor State
|
||||
builder.Services.AddScoped<RobotMonitorState>(sp =>
|
||||
{
|
||||
var mapApiService = sp.GetRequiredService<MapManagerApiService>();
|
||||
var robotApiService = sp.GetRequiredService<RobotApiService>();
|
||||
var robotModelApiService = sp.GetRequiredService<RobotModelApiService>();
|
||||
var hubClient = sp.GetRequiredService<RobotStateHubClient>();
|
||||
return new RobotMonitorState(mapApiService, robotApiService, robotModelApiService, hubClient);
|
||||
});
|
||||
|
||||
// Config Manager Services
|
||||
builder.Services.AddScoped<ConfigApiService>();
|
||||
builder.Services.AddScoped<ConfigManagerState>(sp =>
|
||||
{
|
||||
var configApi = sp.GetRequiredService<ConfigApiService>();
|
||||
var authStateProvider = sp.GetService<AuthenticationStateProvider>();
|
||||
return new ConfigManagerState(configApi, authStateProvider, "Distributor");
|
||||
});
|
||||
|
||||
// Script Engine Services
|
||||
builder.Services.AddScriptEditor<ScriptEngineResource>();
|
||||
|
||||
await builder.Build().RunAsync();
|
||||
Reference in New Issue
Block a user