Ejemplo n.º 1
0
 /// <summary>添加主题</summary>
 /// <param name="theme"></param>
 public void AddTheme(String theme)
 {
     if (!Themes.Contains(theme))
     {
         Themes.Add(theme);
     }
 }
Ejemplo n.º 2
0
        public async Task DeleteThemeAsync(HueTheme theme)
        {
            try
            {
                StorageFolder themeFolder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("Themes", CreationCollisionOption.OpenIfExists);

                StorageFile themeFile = await themeFolder.GetFileAsync(theme.FileName);

                await themeFile.DeleteAsync();

                if (Themes.Contains(theme))
                {
                    Themes.Remove(theme);

                    // Notify theme list changes
                    if (ThemeListChanged != null)
                    {
                        ThemeListChanged(this, null);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds a theme to the registry
        /// </summary>
        /// <param name="theme">The theme to be added</param>
        /// <returns>Whether the the theme is already registered</returns>
        public bool AddTheme(ITheme theme)
        {
            if (Themes.Contains(theme))
            {
                return(false);
            }

            Themes.Add(theme);
            return(true);
        }
Ejemplo n.º 4
0
        private void LoadTheme()
        {
            Logger.Debug("Loading WPF theme.");

            string theme = Settings.Default.Theme;

            if (string.IsNullOrEmpty(theme))
            {
                return;
            }

            if (Themes.Contains(theme))
            {
                Theme = theme;
            }
            else
            {
                Logger.Warn("Invalid theme settings. Using defaults instead.");
            }
        }