-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMauiProgram.cs
More file actions
58 lines (50 loc) · 1.97 KB
/
Copy pathMauiProgram.cs
File metadata and controls
58 lines (50 loc) · 1.97 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
using CommunityToolkit.Maui;
using imago.Services;
using imago.Utils;
using imago.ViewModels;
using Microsoft.Extensions.Logging;
using Microsoft.Maui.Handlers;
namespace imago;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseMauiCommunityToolkit()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
EntryHandler.Mapper.AppendToMapping("EntryBorder", (handler, view) =>
{
handler.PlatformView.Layer.BorderWidth = 1; // Set the border width
handler.PlatformView.Layer.BorderColor =
CoreGraphics.CGColor.CreateSrgb(0.7f, 0.7f, 0.7f, 1); // Fixed color (gray)
handler.PlatformView.Layer.CornerRadius = 5; // Optional: Add rounded corners
});
PickerHandler.Mapper.AppendToMapping("PickerBorder", (handler, view) =>
{
handler.PlatformView.Layer.BorderWidth = 1; // Set the border width
handler.PlatformView.Layer.BorderColor =
CoreGraphics.CGColor.CreateSrgb(0.7f, 0.7f, 0.7f, 1); // Fixed color (gray)
handler.PlatformView.Layer.CornerRadius = 5; // Optional: Add rounded corners
});
// ViewModels
builder.Services.AddSingleton<ImageViewModel>();
builder.Services.AddSingleton<ResizeViewModels>();
// Services
builder.Services.AddSingleton<GlobalStorageService>();
builder.Services.AddSingleton<ToastService>();
builder.Services.AddSingleton<ImageConverterService>();
builder.Services.AddSingleton<ImageLoaderService>();
#if DEBUG
builder.Logging.AddDebug();
#endif
var app = builder.Build();
ServiceLocator.Instance = app.Services;
return app;
}
}