Beispiel #1
0
        public void RefreshStyles(ApplicationTheme?theme = null)
        {
            DebugWrite($"Theme: {theme}");

            RequestedTheme = theme?.ToElementTheme() ?? RequestedTheme;
            RefreshStyles(AccentColor);
        }
Beispiel #2
0
 void OnActiveWindowThemeChanged(object sender = null, EventArgs e = null)
 {
     if (Application.Current is Application app)
     {
         _applicationTheme = app.RequestedTheme;
     }
 }
Beispiel #3
0
 private void SetApplicationTheme(ApplicationTheme?theme)
 {
     DispatcherHelper.RunOnMainThread(() =>
     {
         ThemeManager.Current.ApplicationTheme = theme;
     });
 }
Beispiel #4
0
        internal void SetExplicitRequestedTheme(ApplicationTheme?explicitTheme)
        {
            // this flag makes sure the app will not respond to OS events
            _themeSetExplicitly = explicitTheme.HasValue;
            var theme = explicitTheme ?? GetDefaultSystemTheme();

            SetRequestedTheme(theme);
        }
Beispiel #5
0
        private void SetRequestedTheme(ApplicationTheme requestedTheme)
        {
            if (requestedTheme != _requestedTheme)
            {
                _requestedTheme = requestedTheme;

                OnRequestedThemeChanged();
            }
        }
        public static ApplicationTheme GetTheme()
        {
            ApplicationTheme?theme = App.Settings.GetValueOrDefault <ApplicationTheme?>("ApplicationTheme", null);

            if (theme == null)
            {
                // Default is global phone theme
                Visibility darkBGVisibility = (Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"];
                theme = (darkBGVisibility == Visibility.Visible) ? ApplicationTheme.Dark : ApplicationTheme.Light;
            }
            return((ApplicationTheme)theme);
        }
        public void SaveSettingsToIni()
        {
            var iniFile = new IniFileHandler(ConstantsEnums.IniFilename);

            foreach (var setting in _settings.Where(s => s.PersistToIniFile))
            {
                iniFile.Write(setting.Name, setting.GetValueAsString(), "CameraSettings");
            }

            foreach (ISetting binding in _keyBindings.Where(s => s.PersistToIniFile))
            {
                iniFile.Write(binding.Name, binding.GetValueAsString(), "KeyBindings");
            }

            // other settings
            ApplicationTheme?currentTheme = ThemeManager.Current.ApplicationTheme;
            int themeID = -1;                   // not defined, so use default.

            if (currentTheme != null)
            {
                themeID = (int)currentTheme.Value;
            }
            iniFile.Write("ThemeID", themeID.ToString(), "MiscSettings");
            System.Windows.Media.Color?accentColor = ThemeManager.Current.AccentColor;
            if (accentColor == null)
            {
                iniFile.DeleteKey("AccentColor", "MiscSettings");
            }
            else
            {
                iniFile.Write("AccentColor", accentColor.ToString(), "MiscSettings");
            }

            int counter = 0;

            foreach (var r in _recentlyUsedResolutions)
            {
                // Format: resolution|aspect ratio
                // resulution: widthxheight
                // aspect ratio: width:height
                iniFile.Write("Resolution" + counter, r.ToStringForIniFile(), "RecentlyUsedResolutions");
                counter++;
            }
        }
Beispiel #8
0
 private void UpdateSystemAppTheme()
 {
     SystemTheme = IsDarkBackground(_systemBackground) ? ApplicationTheme.Dark : ApplicationTheme.Light;
 }
 public void RefreshStyles(ApplicationTheme?theme = null)
 {
     RequestedTheme = theme?.ToElementTheme() ?? RequestedTheme;
     RefreshStyles(AccentColor);
 }
Beispiel #10
0
 private AppTheme(string name, ApplicationTheme?value)
 {
     Name  = name;
     Value = value;
 }
Beispiel #11
0
 public AppTheme(string name, ApplicationTheme?value)
 {
     this.Name  = name;
     this.Value = value;
 }
 private static void SetTheme(this ThemeManager manager, ApplicationTheme?theme)
 {
     RxApp.MainThreadScheduler.Schedule(() => manager.ApplicationTheme = theme);
 }