Ejemplo n.º 1
0
        /// <summary>
        /// ThemeHelper - Overrides/Manages the SystemColors Palette in WPF
        /// </summary>
        /// <param name="_DarkMode">Attempt to enable DarkMode features - false will default to "light-mode theme".</param>
        /// <param name="_AutoDarkMode">If DarkMode available, Auto-Init into DarkThemeFeatures</param>

        public ThemeHelper(bool _DarkMode = false, bool _AutoDarkMode = false)
        {
            if (_DarkMode)
            {
                DarkModeAvailable = NTInterop.DarkMode.CanEnableDarkMode();

                if (DarkModeAvailable)
                {
                    DarkModeStatus = NTInterop.DarkMode.GetSystemDarkModeStatus();
                    DarkMode       = (_AutoDarkMode && DarkModeStatus) ? (_AutoDarkMode && DarkModeStatus) : false;
                    NTInterop.DarkMode.SetAppDarkMode(DarkModeAvailable);
                }
                else
                {
                    DarkMode       = false;
                    DarkModeStatus = false;
                    NTInterop.DarkMode.SetAppDarkMode(false);
                }
            }
            else
            {
                DarkMode          = false;
                DarkModeAvailable = false;
                DarkModeStatus    = false;
            }

            ThemePalette = new ImmersiveColors.ColorPalette(DarkMode);
            CurrentTheme = "";
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Reload Immersive ColorPalette to ThemePalette using currently set DarkMode property
 /// </summary>
 public void ReloadTheme()
 {
     ThemePalette = new ImmersiveColors.ColorPalette(DarkMode);
     ApplyTheme();
 }