private void App_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e) { MainThread.BeginInvokeOnMainThread(() => { TheTheme.SetTheme(); }); }
public App() { InitializeComponent(); TheTheme.SetTheme(); if (Config.Desktop) { MainPage = new DesktopShell(); } else { MainPage = new MobileShell(); } Routing.RegisterRoute(nameof(DiscoverPage), typeof(DiscoverPage)); Routing.RegisterRoute(nameof(ShowDetailPage), typeof(ShowDetailPage)); Routing.RegisterRoute(nameof(EpisodeDetailPage), typeof(EpisodeDetailPage)); Routing.RegisterRoute(nameof(CategoriesPage), typeof(CategoriesPage)); Routing.RegisterRoute(nameof(CategoryPage), typeof(CategoryPage)); }
void RadioButton_CheckedChanged(object sender, CheckedChangedEventArgs e) { if (!loaded) { return; } if (!e.Value) { return; } var val = (sender as RadioButton)?.Value as string; if (string.IsNullOrWhiteSpace(val)) { return; } switch (val) { case "System": Settings.Theme = 0; break; case "Light": Settings.Theme = 1; break; case "Dark": Settings.Theme = 2; break; } TheTheme.SetTheme(); }
protected override void OnResume() { TheTheme.SetTheme(); RequestedThemeChanged += App_RequestedThemeChanged; }
protected override void OnSleep() { TheTheme.SetTheme(); RequestedThemeChanged -= App_RequestedThemeChanged; }