inraetemplate / INRAETemplate / MauiProgram.cs @ 7b67ff55
Historique | Voir | Annoter | Télécharger (1,343 ko)
1 |
using CommunityToolkit.Maui; |
---|---|
2 |
using INRAETemplate.Services; |
3 |
using INRAETemplate.View; |
4 |
using INRAETemplate.ViewModel; |
5 |
using Microsoft.Extensions.Logging; |
6 |
|
7 |
namespace INRAETemplate; |
8 |
|
9 |
public static class MauiProgram |
10 |
{ |
11 |
public static MauiApp CreateMauiApp() |
12 |
{ |
13 |
var builder = MauiApp.CreateBuilder(); |
14 |
builder |
15 |
.UseMauiApp<App>() |
16 |
.UseMauiCommunityToolkit() |
17 |
.ConfigureFonts(fonts => |
18 |
{ |
19 |
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); |
20 |
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); |
21 |
fonts.AddFont("fa-brands.ttf", "FABrands"); |
22 |
fonts.AddFont("fa-regular.ttf", "FARegular"); |
23 |
fonts.AddFont("fa-solid.ttf", "FASolid"); |
24 |
}); |
25 |
|
26 |
// Services |
27 |
builder.Services.AddSingleton<ConnexionService>(); |
28 |
|
29 |
// Views |
30 |
builder.Services.AddSingleton<AboutView>(); |
31 |
builder.Services.AddSingleton<SettingsView>(); |
32 |
builder.Services.AddSingleton<VivantEditionView>(); |
33 |
builder.Services.AddSingleton<VivantView>(); |
34 |
|
35 |
// ViewModels |
36 |
builder.Services.AddSingleton<AboutViewModel>(); |
37 |
builder.Services.AddSingleton<SettingsViewModel>(); |
38 |
builder.Services.AddSingleton<VivantEditionViewModel>(); |
39 |
builder.Services.AddSingleton<VivantViewModel>(); |
40 |
|
41 |
|
42 |
#if DEBUG |
43 |
builder.Logging.AddDebug(); |
44 |
#endif |
45 |
|
46 |
return builder.Build(); |
47 |
} |
48 |
} |