-
Notifications
You must be signed in to change notification settings - Fork 2
/
MauiProgram.cs
53 lines (48 loc) · 1.51 KB
/
MauiProgram.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using Microsoft.Extensions.Logging;
using Microsoft.Maui.Controls.Compatibility.Hosting;
using SkiaSharp.Views.Maui.Controls.Hosting;
namespace BatMan2;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseSkiaSharp()
.RegisterServices()
.UseMauiCompatibility()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
})
.ConfigureMauiHandlers(handlers => {
#if IOS
handlers.AddHandler<ContentPage, IOSContentPageHandler>();
#endif
});
#if DEBUG
builder.Logging.AddDebug();
#endif
return builder.Build();
}
private static MauiAppBuilder RegisterServices(this MauiAppBuilder builder) {
builder.Services
.AddSingleton<IReadingStore<Reading>, ReadingStore>()
.AddSingleton<AnalysisViewModel>()
.AddSingleton<AnalysisPage>()
.AddSingleton<HistoryViewModel>()
.AddSingleton<HistoryPage>()
.AddSingleton<SetupViewModel>()
.AddSingleton<SetupPage>()
.AddSingleton<UpdateViewModel>()
.AddSingleton<UpdatePage>()
.AddSingleton<AboutPage>()
.AddSingleton<DeviceViewModel>()
.AddSingleton<DevicePage>()
.AddSingleton<GaugeViewModel>()
.AddSingleton<GaugePage>();
return builder;
}
}