public static Dictionary <string, PropertyEditorBase> GetAllEditors() { Dictionary <string, PropertyEditorBase> result = new Dictionary <string, PropertyEditorBase>(); lock (_GlobalPropertyEditors) { foreach (var item in _GlobalPropertyEditors) { result[item.Key] = item.Value; } } TypeConfigurationCollection editorTypes = PropertyEditorConfigurationSection.GetConfig().Editors; foreach (TypeConfigurationElement typeElem in editorTypes) { PropertyEditorBase editor = (PropertyEditorBase)typeElem.CreateInstance(); if (result.ContainsKey(editor.EditorKey) == false) { result[editor.EditorKey] = editor; } } return(result); }
private void CreateTabControl(TypeConfigurationCollection configs, SqlExerciseItem item, TabPage tab) { tab.Controls.Clear(); try { if (configs.ContainsKey(item.Name)) { TypeConfigurationElement typeElement = configs[item.Name]; UserControl uc = typeElement.CreateInstance() as UserControl; if (uc != null) { tab.Controls.Clear(); uc.Dock = DockStyle.Fill; tab.Controls.Add(uc); } else { tabControl1.TabPages.Remove(tab); } } } catch (Exception ex) { MessageBox.Show(string.Format("加载扩展配置控件失败,异常信息:{0}", ex.Message)); //移除扩展配置项 tabControl1.TabPages.Remove(tab); } }
private void CreateAddIns() { TypeConfigurationCollection addIns = ServiceMainSettings.GetConfig().AddIns; foreach (TypeConfigurationElement ele in addIns) { TabPage page = new TabPage(ele.Description); page.Tag = new TabPageTag(ele); this.tabControlClient.TabPages.Add(page); } }
private static Dictionary <string, IPropertyPersister <T> > GetPersister() { Dictionary <string, IPropertyPersister <T> > result = new Dictionary <string, IPropertyPersister <T> >(); TypeConfigurationCollection persisterTypes = PropertyPersisterSettings.GetConfig().Persisters; //PropertyEditorSettings.GetConfig().Editors; foreach (TypeConfigurationElement typeElem in persisterTypes) { IPropertyPersister <T> editor = (IPropertyPersister <T>)typeElem.CreateInstance(); if (result.ContainsKey(typeElem.Name) == false) { result.Add(typeElem.Name, editor); } } return(result); }
private static Dictionary <string, PropertyEditorBase> GetAllEditors() { Dictionary <string, PropertyEditorBase> result = new Dictionary <string, PropertyEditorBase>(); lock (_GlobalPropertyEditors) { _GlobalPropertyEditors.ForEach(kp => result.Add(kp.Key, kp.Value)); } TypeConfigurationCollection editorTypes = PropertyEditorSettings.GetConfig().Editors; foreach (TypeConfigurationElement typeElem in editorTypes) { PropertyEditorBase editor = (PropertyEditorBase)typeElem.CreateInstance(); if (result.ContainsKey(editor.EditorKey) == false) { result.Add(editor.EditorKey, editor); } } return(result); }
private void CreateTabControl(TypeConfigurationCollection configs, ScheduleItem item, TabPage tab) { tab.Controls.Clear(); try { if (configs.ContainsKey(item.Name)) { TypeConfigurationElement typeElement = configs[item.Name]; UserControl uc = typeElement.CreateInstance() as UserControl; if (uc != null) { tab.Controls.Clear(); uc.Dock = DockStyle.Fill; tab.Controls.Add(uc); } } else tabControl1.TabPages.Remove(tab); } catch (Exception ex) { MessageBox.Show(string.Format("加载扩展配置控件失败,异常信息:{0}", ex.Message)); //移除扩展配置项 tabControl1.TabPages.Remove(tab); } }