9 [Register(
"AppDelegate")]
13 protected override MauiApp CreateMauiApp()
16#warning Remove this line when the issue with the RadioButton control template is fixed in a future version of MAUI https:
20 RadioButtonTemplateWorkaround();
32 public override bool OpenUrl(UIApplication Application, NSUrl Url, NSDictionary Options)
34 if (
string.IsNullOrEmpty(Url.AbsoluteString))
56 public override void OnActivated(UIApplication application)
59 base.OnActivated(application);
62 public override void OnResignActivation(UIApplication application)
65 base.OnResignActivation(application);
68 private static void EnsureKeyWindow()
70 if (GetKeyWindow() is
null)
73 UIWindow? window =
null;
74 if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
76 window = UIApplication.SharedApplication.ConnectedScenes
77 .OfType<UIWindowScene>()
78 .SelectMany(s => s.Windows)
82 window = UIApplication.SharedApplication.Windows.FirstOrDefault();
86 if (!window!.IsKeyWindow)
87 window!.MakeKeyWindow();
95 internal static UIWindow? GetKeyWindow()
97 if (UIDevice.CurrentDevice.CheckSystemVersion(15, 0))
99 return UIApplication.SharedApplication.ConnectedScenes
100 .OfType<UIWindowScene>()
101 .SelectMany(s => s.Windows)
102 .FirstOrDefault(w => w.IsKeyWindow);
104 else if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
105 return UIApplication.SharedApplication.Windows.FirstOrDefault(w => w.IsKeyWindow);
107 return UIApplication.SharedApplication.KeyWindow;
110 private static void RadioButtonTemplateWorkaround()
112 Microsoft.Maui.Handlers.RadioButtonHandler.Mapper.AppendToMapping(
"TemplateWorkaround", (h, v) =>
114 if (h.PlatformView.CrossPlatformLayout is RadioButton radioButton)
116 radioButton.IsEnabled = false;
117 radioButton.ControlTemplate = RadioButton.DefaultTemplate;
118 radioButton.IsEnabled = true;
119 radioButton.ControlTemplate = AppStyles.RadioButtonTemplate;
override bool OpenUrl(UIApplication Application, NSUrl Url, NSDictionary Options)
Method is called when an URL with a registered schema is being opened.
The Application class, representing an instance of the Neuro-Access app.
static void OpenUrlSync(string Url)
Opens an URL in the application.
Base class that references services in the app.
static ILogService LogService
Log service.