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); } }
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; }
public abstract void AddCategoryElement(ISettingsCategory settingsCategory);
public StorableTabsAndWindowsOptions(ISettingsManager settingsManager) : base(settingsManager) { _localPreferences = DockingManagerPreferences.Instance; Category = Settings.TabsAndWindowsCategory; }
public StorableEnvironmentGeneralOptions(ISettingsManager settingsManager, EnvironmentGeneralOptions generalOptions) : base(settingsManager) { _generalOptions = generalOptions; Category = ToolsOptionsSubCategories.GeneralSubCategory; }