Example #1
0
        public override void AddCategoryElement(ISettingsCategory category)
        {
            foreach (var settingsCategory in category.Path)
            {
                if (GetSingleNode(settingsCategory.Name) != null)
                {
                    continue;
                }
                XmlNode parentNode;
                if (settingsCategory.Parent == null)
                {
                    if (settingsCategory.CategoryType == SettingsCategoryType.ToolsOption)
                    {
                        parentNode = GetSingleNode("ToolsOptions", false) ??
                                     SettingsStorage.DocumentElement?.AppendChild(
                            CreateToolsOptionsElement(SettingsStorage));
                    }
                    else
                    {
                        parentNode = GetSingleNode(string.Empty, false);
                    }
                }
                else
                {
                    AddCategoryElement(settingsCategory.Parent);
                    parentNode = GetSingleNode(settingsCategory.Parent.Name);
                }

                XmlElement element;
                switch (settingsCategory.CategoryType)
                {
                case SettingsCategoryType.ToolsOption:
                    element = SettingsStorage.CreateElement("ToolsOptionsCategory", string.Empty,
                                                            new KeyValuePair <string, string>("name", settingsCategory.Name));
                    break;

                case SettingsCategoryType.ToolsOptionSub:
                    element = SettingsStorage.CreateElement("ToolsOptionsSubCategory", string.Empty,
                                                            new KeyValuePair <string, string>("name", settingsCategory.Name));
                    break;

                case SettingsCategoryType.Normal:
                    element = SettingsStorage.CreateElement("Category", null,
                                                            new KeyValuePair <string, string>("name", settingsCategory.Name),
                                                            new KeyValuePair <string, string>("RegisteredName", settingsCategory.Name));
                    if (!settingsCategory.HasChildren)
                    {
                        element.SetAttribute("Category", settingsCategory.Id.ToString("B"));
                    }
                    break;

                default:
                    throw new NotSupportedException();
                }
                lock (_lockObk)
                    parentNode?.AppendChild(element);
            }
        }
Example #2
0
 public SettingsCategory(Guid id, SettingsCategoryType type, string name, ISettingsCategory parent)
 {
     Children     = new List <ISettingsCategory>();
     CategoryType = type;
     Name         = name;
     Parent       = parent;
     if (parent != null)
     {
         Parent.Children.Add(this);
     }
     Id = id;
 }
Example #3
0
 public abstract void AddCategoryElement(ISettingsCategory settingsCategory);
Example #4
0
 public StorableTabsAndWindowsOptions(ISettingsManager settingsManager) : base(settingsManager)
 {
     _localPreferences = DockingManagerPreferences.Instance;
     Category          = Settings.TabsAndWindowsCategory;
 }
Example #5
0
 public StorableEnvironmentGeneralOptions(ISettingsManager settingsManager, EnvironmentGeneralOptions generalOptions) : base(settingsManager)
 {
     _generalOptions = generalOptions;
     Category        = ToolsOptionsSubCategories.GeneralSubCategory;
 }