예제 #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
        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;
        }
        /// <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);
        }
        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;
                }
            }
        }
        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
 private void Current_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     ((MainPage)MainPage).ThemeUpdates.Add($"{num}: {e.RequestedTheme}");
     num++;
 }
예제 #16
0
 void ThemeChanged(object sender, AppThemeChangedEventArgs e) => ChangeTheme(e.RequestedTheme);
예제 #17
0
 void HandleThemeChanged(object sender, AppThemeChangedEventArgs e) => SetOnboardingItems();
 private void Current_RequestedThemeChanged(object sender, AppThemeChangedEventArgs e)
 {
     _currentThemeLabel.Text = Application.Current.RequestedTheme.ToString();
 }
예제 #19
0
 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}");
 }
 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
 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;
 }