zhaw-dnet2/Tasks/Lab12/TodoDetails/MauiProgram.cs

36 lines
1.1 KiB
C#

using Microsoft.Extensions.Logging;
using TodoDetails.Services;
using TodoDetails.View;
using TodoDetails.ViewModel;
namespace TodoDetails
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
#if DEBUG
builder.Logging.AddDebug();
#endif
builder.Services.AddSingleton<TodoService>();
builder.Services.AddSingleton<TodosViewModel>();
builder.Services.AddSingleton<MainPage>();
builder.Services.AddSingleton<SettingsViewModel>();
builder.Services.AddSingleton<SettingsPage>();
builder.Services.AddTransient<TodoDetailsViewModel>();
builder.Services.AddTransient<TodoDetailsPage>();
return builder.Build();
}
}
}