示例#1
0
        /// <summary>
        /// Handles the switch for each of the available wallpaper type modes.
        /// </summary>
        /// <param name="type">The wallpaper type that is selected</param>
        /// <param name="newTheme">The new theme that is targeted to be set</param>
        private void HandleSwitchByType(WallpaperType type, Theme newTheme)
        {
            if (type == WallpaperType.Individual)
            {
                WallpaperHandler.SetWallpapers(Settings.Component.Monitors, Settings.Component.Position, newTheme);
                currentIndividualTheme = newTheme;
                currentGlobalTheme     = Theme.Unknown;
                currentSolidColorTheme = Theme.Unknown;
            }
            else if (type == WallpaperType.Global)
            {
                WallpaperHandler.SetGlobalWallpaper(Settings.Component.GlobalWallpaper, newTheme);
                currentGlobalTheme     = newTheme;
                currentIndividualTheme = Theme.Unknown;
                currentSolidColorTheme = Theme.Unknown;
            }
            else if (type == WallpaperType.All)
            {
                bool globalSwitched = false;
                if (currentGlobalTheme != newTheme)
                {
                    WallpaperHandler.SetGlobalWallpaper(Settings.Component.GlobalWallpaper, newTheme);
                    globalSwitched = true;
                }
                if (currentIndividualTheme != newTheme || globalSwitched)
                {
                    WallpaperHandler.SetWallpapers(Settings.Component.Monitors, Settings.Component.Position, newTheme);
                }
                currentGlobalTheme     = newTheme;
                currentIndividualTheme = newTheme;
                currentSolidColorTheme = Theme.Unknown;
            }
            else if (type == WallpaperType.SolidColor)
            {
                WallpaperHandler.SetSolidColor(Settings.Component.SolidColors, newTheme);
                currentSolidColorTheme = newTheme;
                currentGlobalTheme     = Theme.Unknown;
                currentIndividualTheme = Theme.Unknown;
            }
            ThemeHandler.SyncCustomThemeToDisk();
            ThemeFile temp = new(RegistryHandler.GetActiveThemePath());

            temp.Load();
            GlobalState.ManagedThemeFile.Desktop = temp.Desktop;
            GlobalState.ManagedThemeFile.Colors  = temp.Colors;
        }
 /// <summary>
 /// Handles the switch for each of the available wallpaper type modes.
 /// </summary>
 /// <param name="type">The wallpaper type that is selected</param>
 /// <param name="newTheme">The new theme that is targeted to be set</param>
 private void HandleSwitchByType(WallpaperType type, Theme newTheme)
 {
     if (type == WallpaperType.Individual)
     {
         WallpaperHandler.SetWallpapers(Settings.Component.Monitors, Settings.Component.Position, newTheme);
         currentIndividualTheme = newTheme;
         currentGlobalTheme     = Theme.Unknown;
         currentSolidColorTheme = Theme.Unknown;
     }
     else if (type == WallpaperType.Global)
     {
         WallpaperHandler.SetGlobalWallpaper(Settings.Component.GlobalWallpaper, newTheme);
         currentGlobalTheme     = newTheme;
         currentIndividualTheme = Theme.Unknown;
         currentSolidColorTheme = Theme.Unknown;
     }
     else if (type == WallpaperType.All)
     {
         bool globalSwitched = false;
         if (currentGlobalTheme != newTheme)
         {
             WallpaperHandler.SetGlobalWallpaper(Settings.Component.GlobalWallpaper, newTheme);
             globalSwitched = true;
         }
         if (currentIndividualTheme != newTheme || globalSwitched)
         {
             WallpaperHandler.SetWallpapers(Settings.Component.Monitors, Settings.Component.Position, newTheme);
         }
         currentGlobalTheme     = newTheme;
         currentIndividualTheme = newTheme;
         currentSolidColorTheme = Theme.Unknown;
     }
     else if (type == WallpaperType.SolidColor)
     {
         WallpaperHandler.SetSolidColor(Settings.Component.SolidColors, newTheme);
         currentSolidColorTheme = newTheme;
         currentGlobalTheme     = Theme.Unknown;
         currentIndividualTheme = Theme.Unknown;
     }
 }