Files
Taske.UI/Program.cs
T

37 lines
1.5 KiB
C#

using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using MudBlazor;
using MudBlazor.Services;
using Tasks.Module.Services;
using UI;
using UI.Components;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
// Configure HTTP client for Tasks API
var tasksApiUrl = builder.Configuration["ApiSettings:TasksUrl"] ?? "http://localhost:5000";
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(tasksApiUrl) });
// Add MudBlazor services
builder.Services.AddMudServices(config =>
{
config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomRight;
config.SnackbarConfiguration.PreventDuplicates = false;
config.SnackbarConfiguration.ShowCloseIcon = true;
config.SnackbarConfiguration.VisibleStateDuration = 3000;
config.SnackbarConfiguration.HideTransitionDuration = 100;
config.SnackbarConfiguration.ShowTransitionDuration = 100;
config.SnackbarConfiguration.SnackbarVariant = Variant.Filled;
});
// Register services
builder.Services.AddScoped<ITodoService, TodoService>();
builder.Services.AddScoped<IFolderService, FolderService>();
builder.Services.AddScoped<IViewService, Tasks.Module.Services.ViewService>();
builder.Services.AddScoped<ICategoryService, CategoryService>();
builder.Services.AddScoped<ITagService, TagService>();
await builder.Build().RunAsync();