Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
MauiProgram.cs
1using CommunityToolkit.Maui;
2using CommunityToolkit.Maui.Markup;
3using Microsoft.Extensions.Logging;
4using Microsoft.Maui.Controls.Handlers.Items;
5using Microsoft.Maui.Handlers;
6using Mopups.Hosting;
11using ZXing.Net.Maui.Controls;
12using DotNet.Meteor.HotReload.Plugin;
13using Microsoft.Maui.Platform;
14
15
16
17#if ANDROID
18using Microsoft.Maui.Controls.Compatibility.Platform.Android;
19#endif
20
21namespace NeuroAccessMaui
22{
23 public static class MauiProgram
24 {
25 private static MauiApp? instance;
26
27 public static MauiApp CreateMauiApp()
28 {
29 InitMauiControlsHandlers();
30
31 MauiAppBuilder Builder = MauiApp.CreateBuilder();
32
33 Builder.UseMauiApp<App>();
34#if DEBUG
35 Builder.EnableHotReload();
36#endif
37
38 Builder.ConfigureFonts(fonts =>
39 {
40 fonts.AddFont("SpaceGrotesk-Bold.ttf", "SpaceGroteskBold");
41 //fonts.AddFont("SpaceGrotesk-SemiBold.ttf", "SpaceGroteskSemiBold");
42 fonts.AddFont("SpaceGrotesk-Medium.ttf", "SpaceGroteskMedium");
43 fonts.AddFont("SpaceGrotesk-Regular.ttf", "SpaceGroteskRegular");
44 //fonts.AddFont("SpaceGrotesk-Light.ttf", "SpaceGroteskLight");
45 fonts.AddFont("NHaasGroteskTXPro-75Bd.ttf", "HaasGroteskBold");
46 //fonts.AddFont("NHaasGroteskTXPro-65Md.ttf", "HaasGroteskMedium");
47 fonts.AddFont("NHaasGroteskTXPro-55Rg.ttf", "HaasGroteskRegular");
48 });
49
50 // NuGets
51 Builder.ConfigureMopups();
52 Builder.UseMauiCommunityToolkit();
53 Builder.UseMauiCommunityToolkitMarkup();
54 Builder.UseBarcodeReader();
55
56 // Localization service
57 Builder.UseLocalizationManager<AppResources>();
58
59 // Singleton app's services
60 Builder.Services.AddSingleton<IPlatformSpecific, PlatformSpecific>();
61
62 // Apps pages & models
63 Builder.RegisterPagesManager();
64
65 //Builder.Services.AddLogging();
66#if DEBUG
67 Builder.Logging.AddDebug();
68#endif
69
70 instance = Builder.Build();
71
72 return instance;
73 }
74
78 public static MauiApp? Current => instance;
79
80 private static void InitMauiControlsHandlers()
81 {
82#if IOS
83 ScrollViewHandler.Mapper.AppendToMapping("BouncesScrollViewHandler", (handler, view) =>
84 {
85 handler.PlatformView.Bounces = false;
86 });
87
88 CollectionViewHandler.Mapper.AppendToMapping("BouncesCollectionViewHandler", (handler, view) =>
89 {
92 });
93
94 Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("BorderStyleEntryHandler", (handler, view) =>
95 {
96 handler.PlatformView.BorderStyle = UIKit.UITextBorderStyle.None;
97 });
98#elif ANDROID
99 ScrollViewHandler.Mapper.AppendToMapping("OverScrollModeScrollViewHandler", (handler, view) =>
100 {
101 handler.PlatformView.OverScrollMode = Android.Views.OverScrollMode.Never;
102 });
103
104 CollectionViewHandler.Mapper.AppendToMapping("OverScrollModeCollectionViewHandler", (handler, view) =>
105 {
106 handler.PlatformView.OverScrollMode = Android.Views.OverScrollMode.Never;
107 });
108
109 EntryHandler.Mapper.AppendToMapping("NoUnderlineEntryHandler", (handler, view) =>
110 {
111 handler.PlatformView.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(Colors.Transparent.ToAndroid());
112 });
113 ImageHandler.Mapper.PrependToMapping(nameof(Microsoft.Maui.IImage.Source), (handler, view) =>
114 {
115 handler.PlatformView?.Clear();
116 });
117
118#endif
119 }
120 }
121}
The Application class, representing an instance of the Neuro-Access app.
Definition: App.xaml.cs:69
static ? MauiApp Current
Current MAUI app instance.
Definition: MauiProgram.cs:78
Android implementation of platform-specific features.
Interface for platform-specific functions.