예제 #1
0
 private void App_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     MainThread.BeginInvokeOnMainThread(() =>
     {
         TheTheme.SetTheme();
     });
 }
예제 #2
0
    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));
    }
예제 #3
0
        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();
        }
예제 #4
0
 protected override void OnResume()
 {
     TheTheme.SetTheme();
     RequestedThemeChanged += App_RequestedThemeChanged;
 }
예제 #5
0
 protected override void OnSleep()
 {
     TheTheme.SetTheme();
     RequestedThemeChanged -= App_RequestedThemeChanged;
 }