コード例 #1
0
        public void RenameEditorControlTheme(string themeName, string newName)
        {
            if (string.IsNullOrWhiteSpace(themeName))
            {
                throw new ArgumentException("Editor theme name cannot be null or whitespace.",
                                            "themeName");
            }

            if (string.IsNullOrWhiteSpace(newName))
            {
                throw new ArgumentException("Editor theme name cannot be null or whitespace.",
                                            "newName");
            }


            if (!EditorControlThemes.ContainsKey(themeName))
            {
                throw new ArgumentException(
                          string.Format("Editor theme named {0} does not exist.", themeName),
                          "themeName");
            }

            bool resetCurrentlySelected = AppSettings.Settings.CurrentEditorControlThemeName == themeName;

            var old = EditorControlThemes[themeName];

            EditorControlThemes.Remove(themeName);
            EditorControlThemes.Add(newName, old);

            if (resetCurrentlySelected)
            {
                AppSettings.Settings.CurrentEditorControlThemeName = newName;
            }
        }
コード例 #2
0
        public void AddEditorControlTheme(string themeName)
        {
            if (string.IsNullOrWhiteSpace(themeName))
            {
                throw new ArgumentException("Editor theme name cannot be null or whitespace.",
                                            "themeName");
            }

            if (EditorControlThemes.ContainsKey(themeName))
            {
                throw new ArgumentException(
                          string.Format("Editor theme named {0} already exist.", themeName),
                          "themeName");
            }


            EditorControlThemes.Add(themeName,
                                    DefaultValueInitializer.Init(new EditorControlThemeNode()));
        }