private void loadSettings() { foreach (var setting in SettingsManager.Instance.RegisteredSettings) { ISettingEditorControl editorControl = SettingEditorTypeRegister.GetEditorForSetting(setting); Control editorControlCasted = editorControl as Control; if (editorControlCasted != null) { editorControlCasted.Dock = DockStyle.Top; getPageForCategory(setting.Category).Controls.Add(editorControlCasted); } } }
private static Type GetTypeForEditor(ISettingEditorControl editor) { object[] attributes = editor.GetType().GetCustomAttributes(true); object foundAttribute = attributes.FirstOrDefault(attr => (attr is SettingEditorControlTypeAttribute)); if (foundAttribute == null) { return(null); } SettingEditorControlTypeAttribute typedAttribute = foundAttribute as SettingEditorControlTypeAttribute; return(typedAttribute?.Type); }
private void loadSettings() { foreach (var setting in SettingsManager.Instance.RegisteredSettings) { ISettingEditorControl editorControl = SettingEditorTypeRegister.Instance.GetEditorForSetting(setting); Control editorControlCasted = editorControl as Control; if (editorControlCasted != null) { editorControlCasted.Dock = DockStyle.Top; TabPage pageForCategory = getPageForCategory(setting.Category); Control.ControlCollection pagesControlCollection = pageForCategory.Controls; pagesControlCollection.Add(editorControlCasted); pagesControlCollection.SetChildIndex(editorControlCasted, 0); } } }