예제 #1
0
 /// <summary>
 /// Revert the theme. If custom is specified and a custom theme is
 /// found, revert to that. Otherwise revert to the default system theme.
 /// </summary>
 public static void RevertConfig(bool custom)
 {
     if (!custom)
     {
         if (File.Exists(CustomThemeFile))
         {
             File.Delete(CustomThemeFile);
         }
         Themes.Remove(Resources.Custom);
     }
     CurrentTheme = (custom) ? Resources.Custom : Resources.Default;
     _uiConfig    = ParseConfig();
     InvokeThemeChanged();
 }
예제 #2
0
 /// <summary>
 /// Merge the specified UIConfig into this one.
 /// </summary>
 /// <param name="config">A UIConfig to merge</param>
 public void Merge(UIConfig config)
 {
     if (config.menuField != null)
     {
         menuField[0].Merge(config.menuField[0]);
     }
     if (config.systemField != null)
     {
         systemField[0].Merge(config.systemField[0]);
     }
     if (config.forumsField != null)
     {
         forumsField[0].Merge(config.forumsField[0]);
     }
     if (config.keysField != null)
     {
         keysField[0].Merge(config.keysField[0]);
     }
 }
예제 #3
0
        /// <summary>
        /// Parse the current theme file.
        /// </summary>
        private static UIConfig ParseConfig()
        {
            UIConfig uiConfig = null;

            try
            {
                UITheme theme = Themes[CurrentTheme];
                if (theme == null || !File.Exists(theme.Path))
                {
                    theme = Themes[Resources.Default];
                    Preferences.StandardPreferences.CurrentTheme = Resources.Default;
                }
                if (theme != null)
                {
                    UIConfig uiDefaultConfig = null;

                    if (!theme.IsDefault)
                    {
                        UITheme defaultTheme = Themes[Resources.Default];
                        uiDefaultConfig = ParseConfigFile(defaultTheme.Path);
                    }

                    string uiFilePath = theme.Path;
                    uiConfig = ParseConfigFile(uiFilePath);

                    if (uiDefaultConfig != null)
                    {
                        uiDefaultConfig.Merge(uiConfig);
                        uiConfig = uiDefaultConfig;
                    }

                    CIX.UIConfigFolder = Path.GetDirectoryName(uiFilePath);

                    LogFile.WriteLine("Loaded UI themes from {0}", uiFilePath);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(@"Cannot open theme file. " + e.Message);
            }
            return(uiConfig);
        }
예제 #4
0
 /// <summary>
 /// Merge the specified UIConfig into this one.
 /// </summary>
 /// <param name="config">A UIConfig to merge</param>
 public void Merge(UIConfig config)
 {
     if (config.menuField != null)
     {
         menuField[0].Merge(config.menuField[0]);
     }
     if (config.systemField != null)
     {
         systemField[0].Merge(config.systemField[0]);
     }
     if (config.forumsField != null)
     {
         forumsField[0].Merge(config.forumsField[0]);
     }
     if (config.keysField != null)
     {
         keysField[0].Merge(config.keysField[0]);
     }
 }
예제 #5
0
 /// <summary>
 /// Revert the theme. If custom is specified and a custom theme is
 /// found, revert to that. Otherwise revert to the default system theme.
 /// </summary>
 public static void RevertConfig(bool custom)
 {
     if (!custom)
     {
         if (File.Exists(CustomThemeFile))
         {
             File.Delete(CustomThemeFile);
         }
         Themes.Remove(Resources.Custom);
     }
     CurrentTheme = (custom) ? Resources.Custom : Resources.Default;
     _uiConfig = ParseConfig();
     InvokeThemeChanged();
 }