-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMauiProgram.cs
More file actions
62 lines (56 loc) · 2.41 KB
/
MauiProgram.cs
File metadata and controls
62 lines (56 loc) · 2.41 KB
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
using CommunityToolkit.Maui;
using Microsoft.Extensions.Logging;
using Syncfusion.Maui.Toolkit.Hosting;
namespace WebTest
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseMauiCommunityToolkit()
.ConfigureSyncfusionToolkit()
.ConfigureMauiHandlers(handlers =>
{
#if WINDOWS
Microsoft.Maui.Controls.Handlers.Items.CollectionViewHandler.Mapper.AppendToMapping("KeyboardAccessibleCollectionView", (handler, view) =>
{
handler.PlatformView.SingleSelectionFollowsFocus = false;
});
Microsoft.Maui.Handlers.ContentViewHandler.Mapper.AppendToMapping(nameof(Pages.Controls.CategoryChart), (handler, view) =>
{
if (view is Pages.Controls.CategoryChart && handler.PlatformView is Microsoft.Maui.Platform.ContentPanel contentPanel)
{
contentPanel.IsTabStop = true;
}
});
#endif
})
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
fonts.AddFont("SegoeUI-Semibold.ttf", "SegoeSemibold");
fonts.AddFont("FluentSystemIcons-Regular.ttf", FluentUI.FontFamily);
});
#if DEBUG
builder.Logging.AddDebug();
builder.Services.AddLogging(configure => configure.AddDebug());
#endif
builder.Services.AddSingleton<ProjectRepository>();
builder.Services.AddSingleton<TaskRepository>();
builder.Services.AddSingleton<CategoryRepository>();
builder.Services.AddSingleton<TagRepository>();
builder.Services.AddSingleton<SeedDataService>();
builder.Services.AddSingleton<ModalErrorHandler>();
builder.Services.AddSingleton<MainPageModel>();
builder.Services.AddSingleton<ProjectListPageModel>();
builder.Services.AddSingleton<ManageMetaPageModel>();
builder.Services.AddTransientWithShellRoute<ProjectDetailPage, ProjectDetailPageModel>("project");
builder.Services.AddTransientWithShellRoute<TaskDetailPage, TaskDetailPageModel>("task");
return builder.Build();
}
}
}