コード例 #1
0
 /// <summary>
 /// Evento para trocar a aparência do app de acordo com o estado deste
 /// </summary>
 /// <param name="sender">Objeto sender</param>
 /// <param name="e">Parâmetro e</param>
 private void App_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     MainThread.BeginInvokeOnMainThread(() =>
     {
         AparenciaHelper.AplicarAparencia();
     });
 }
コード例 #2
0
ファイル: App.xaml.cs プロジェクト: GeorgeLeithead/LiLo.Lite
        private void App_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
        {
            int themeRequested = (int)e.RequestedTheme;

            Preferences.Set(Constants.Preferences.Settings.Theme, themeRequested);
            SetTheme();
        }
コード例 #3
0
        private void Current_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
        {
            var darkColor  = (Color)Application.Current.Resources["SecondaryDarkMainColor"];
            var lightColor = (Color)Application.Current.Resources["SecondaryLightMainColor"];

            StatusBar.SetStatusBarColor(e.RequestedTheme == OSAppTheme.Dark ? darkColor : lightColor);
        }
コード例 #4
0
 private void App_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     MainThread.BeginInvokeOnMainThread(() =>
     {
         TheTheme.SetTheme();
     });
 }
コード例 #5
0
        private void OnRequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
        {
            DebugPage.WriteLine($"Theme changed on {GetType().Name} to: {e.RequestedTheme}");

            // Re-render UI when app theme changes between dark/light
            StateHasChanged();
        }
コード例 #6
0
 private void HandleRequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     if (e.RequestedTheme != _currentTheme)
     {
         _currentTheme = e.RequestedTheme;
         SetTheme(_currentTheme);
     }
 }
コード例 #7
0
        void OnRequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
        {
            string requestedTheme = $"{_count}: {e.RequestedTheme}";

            Debug.WriteLine(requestedTheme);

            _themes.Text += requestedTheme + Environment.NewLine;
            _count++;
        }
コード例 #8
0
        private void ApplicationRequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
        {
            var applicationStateService = DependencyService.Get <IApplicationStateService>();

            if (!applicationStateService.IsApplicationActive)
            {
                return;
            }

            this.CanChangeTheme = this.control.IsThemable && Xamarin.Forms.Application.Current.RequestedTheme != OSAppTheme.Dark;
        }
コード例 #9
0
        /// <summary>
        /// Reponsible to persist the theme selected by user.
        /// </summary>
        /// <param name="theme">Theme selected by user.</param>
        public void PersistApplicationTheme(string theme)
        {
            Properties.Settings.Default.Theme = theme;
            Properties.Settings.Default.Save();

            AppThemeChangedEventArgs eventArgs = new AppThemeChangedEventArgs()
            {
                SelectedTheme = theme
            };

            this.AppThemeChanged(this, eventArgs);
        }
コード例 #10
0
        private void OnRequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
        {
            Xamarin.Forms.Application.Current.RequestedThemeChanged -= this.OnRequestedThemeChanged;

            var theme = Xamarin.Forms.Application.Current.UserAppTheme;

            if (theme == OSAppTheme.Unspecified)
            {
                AppCompatDelegate.DefaultNightMode = AppCompatDelegate.ModeNightUnspecified;
            }
            else
            {
                AppCompatDelegate.DefaultNightMode = theme == OSAppTheme.Dark ? AppCompatDelegate.ModeNightYes : AppCompatDelegate.ModeNightNo;
            }
        }
コード例 #11
0
        private void Current_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
        {
            switch (e.RequestedTheme)
            {
            case OSAppTheme.Unspecified:
                break;

            case OSAppTheme.Light:
                break;

            case OSAppTheme.Dark:
                break;

            default:
                break;
            }
        }
コード例 #12
0
        void OnRequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
        {
            ResourceDictionary previousTheme, currentTheme;

            if (e.RequestedTheme == OSAppTheme.Dark)
            {
                previousTheme = _lightTheme;
                currentTheme  = _darkTheme;
            }
            else
            {
                previousTheme = _darkTheme;
                currentTheme  = _lightTheme;
            }

            var mergedDictionaries = Resources.MergedDictionaries;

            mergedDictionaries.Remove(previousTheme);
            mergedDictionaries.Add(currentTheme);
        }
コード例 #13
0
        private void App_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
        {
            var mergedDictionaries = Current.Resources.MergedDictionaries;

            if (mergedDictionaries != null)
            {
                mergedDictionaries.Clear();

                switch (e.RequestedTheme)
                {
                case OSAppTheme.Light:
                    mergedDictionaries.Add(new Light());
                    break;

                case OSAppTheme.Dark:
                default:
                    mergedDictionaries.Add(new Dark());
                    break;
                }
            }
        }
コード例 #14
0
        private void OnRequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
        {
            if (UIApplication.SharedApplication.ApplicationState == UIApplicationState.Background)
            {
                return;
            }

            var theme = Xamarin.Forms.Application.Current.UserAppTheme;

            if (theme == OSAppTheme.Unspecified)
            {
                this.Window.OverrideUserInterfaceStyle = UIUserInterfaceStyle.Unspecified;
            }
            else
            {
                this.Window.OverrideUserInterfaceStyle = theme == OSAppTheme.Dark ? UIUserInterfaceStyle.Dark : UIUserInterfaceStyle.Light;
            }

            if (Xamarin.Forms.Application.Current.RequestedTheme == OSAppTheme.Dark)
            {
                this.SetControlsDefaultTheme();
            }
        }
コード例 #15
0
ファイル: App.xaml.cs プロジェクト: Eilon/XamarinThemeChange
 private void Current_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     ((MainPage)MainPage).ThemeUpdates.Add($"{num}: {e.RequestedTheme}");
     num++;
 }
コード例 #16
0
ファイル: ThemeHandler.cs プロジェクト: OliverFlecke/JumpRope
 void ThemeChanged(object sender, AppThemeChangedEventArgs e) => ChangeTheme(e.RequestedTheme);
コード例 #17
0
ファイル: IntroViewModel.cs プロジェクト: rayxxi/MVP
 void HandleThemeChanged(object sender, AppThemeChangedEventArgs e) => SetOnboardingItems();
コード例 #18
0
 private void Current_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     _currentThemeLabel.Text = Application.Current.RequestedTheme.ToString();
 }
コード例 #19
0
ファイル: OnAppThemeExtension.cs プロジェクト: zmtzawqlp/maui
 void RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     Value = GetValue();
 }
コード例 #20
0
 internal void ThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     OnThemeChanged(e.RequestedTheme);
 }
コード例 #21
0
        void OnRequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
        {
            AppTheme requestedTheme = e.RequestedTheme;

            ThemeLabel.Text = requestedTheme.ToString();
        }
コード例 #22
0
ファイル: App.xaml.cs プロジェクト: 007vel/Terra
 private void App_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     Debug.WriteLine($"Requested: {e.RequestedTheme}");
 }
コード例 #23
0
 private void HandleAppThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     this.SetupApplicationTheme();
 }
コード例 #24
0
ファイル: ThemeService.cs プロジェクト: Cricle/Anf
 private void OnCurrentRequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     RaisePropertyChanged(nameof(Theme));
 }
コード例 #25
0
 private void OnRequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     this.Window.OverrideUserInterfaceStyle = UIUserInterfaceStyle.Light;
 }
コード例 #26
0
ファイル: App.xaml.cs プロジェクト: tylerrex96/Micro-C-App
 private void App_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     SwitchTheme(e.RequestedTheme);
 }
コード例 #27
0
 private void Current_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     App.Current.MainPage.DisplayAlert("App Alert", App.Current.UserAppTheme.ToString(), "ok");
 }
コード例 #28
0
 private void Current_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     Task.Run(new Action(loadCategories));
 }
コード例 #29
0
 private void Current_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     SentrySdk.AddBreadcrumb(e.RequestedTheme.ToString(), "AppTheme.Change", level: BreadcrumbLevel.Info);
 }
コード例 #30
0
 private void Current_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     App.Current.UserAppTheme = e.RequestedTheme;
 }