-
Notifications
You must be signed in to change notification settings - Fork 0
/
MauiProgram.cs
70 lines (63 loc) · 2.66 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright © 2023-2024 PSPDFKit GmbH. All rights reserved.
//
// THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
// AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
// UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
// This notice may not be removed from this file.
using PSPDFKit.Maui.Catalog.Examples.ViewModels;
using PSPDFKit.Maui.Catalog.Examples.Views;
#if DEBUG
using Microsoft.Extensions.Logging;
#endif
namespace PSPDFKit.Maui.Catalog;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
return builder
.UseMauiApp<App>()
// https://learn.microsoft.com/en-us/dotnet/architecture/maui/dependency-injection#registration
.RegisterPSPDFKitSdk()
.RegisterViewModels()
.RegisterViews()
.RegisterLogging()
.UseMauiCommunityToolkit()
.Build();
}
private static MauiAppBuilder RegisterViewModels(this MauiAppBuilder builder)
{
builder.Services.AddTransient<AboutPageViewModel>();
builder.Services.AddTransient<ActivateToolsViewModel>();
builder.Services.AddTransient<AdvanceAPIAccessViewModel>();
builder.Services.AddTransient<AnnotationsViewModel>();
builder.Services.AddTransient<AnnotationToolbarCustomizationViewModel>();
builder.Services.AddTransient<ExportDocumentViewModel>();
builder.Services.AddTransient<InstantJsonViewModel>();
builder.Services.AddTransient<LoadDocumentViewModel>();
builder.Services.AddTransient<MainToolbarCustomizationViewModel>();
builder.Services.AddTransient<PlaygroundViewModel>();
return builder;
}
private static MauiAppBuilder RegisterViews(this MauiAppBuilder builder)
{
builder.Services.AddTransient<AboutPage>();
builder.Services.AddTransient<ActivateTools>();
builder.Services.AddTransient<AdvanceAPIAccess>();
builder.Services.AddTransient<Annotations>();
builder.Services.AddTransient<AnnotationToolbarCustomization>();
builder.Services.AddTransient<ExportDocument>();
builder.Services.AddTransient<InstantJson>();
builder.Services.AddTransient<LoadDocument>();
builder.Services.AddTransient<MainToolbarCustomization>();
builder.Services.AddTransient<Playground>();
return builder;
}
private static MauiAppBuilder RegisterLogging(this MauiAppBuilder builder)
{
#if DEBUG
builder.Logging.AddDebug();
#endif
return builder;
}
}