コード例 #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()));
        }
コード例 #3
0
        public void RemoveEditorControlTheme(string themeName, string newCurrentThemeName)
        {
            if (string.IsNullOrWhiteSpace(themeName))
            {
                throw new ArgumentException("Editor theme name cannot be null or whitespace.",
                                            "themeName");
            }

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


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

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

            if (EditorControlThemes.Count == 1)
            {
                throw new InvalidOperationException(
                          "There must be at least one editor theme present in the " +
                          "application settings, cannot remove the theme as it is the only one present.");
            }


            EditorControlThemes.Remove(themeName);

            CurrentEditorControlThemeName = newCurrentThemeName;
        }