public void InitialNodes() { base.Nodes.Clear(); //build Root node BaseNode Root = new BaseNode("Templates"); base.Nodes.Add(Root); //build Template node Collection <TemplateInfo> templates = ConfigCtrl.GetTemplates(); if (templates != null) { foreach (TemplateInfo item in templates) { TemplateNode tn = new TemplateNode(item.Name); tn.Template = new TemplateInfo(item.FullPath, item.Name); Root.Nodes.Add(tn); RefreshTemplateNode(tn); } } if (Root.Nodes.Count > 0) { Root.Expand(); } }
private void OnRefreshTemplateClick(object o, EventArgs e) { try { TemplateNode tn = this.SelectedNode as TemplateNode; RefreshTemplateNode(tn); } catch (Exception ex) { MessageBox.Show(ex.Message, CGConstants.MSG_SYSTEMERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void RefreshTemplateNode(TemplateNode tn) { if (tn != null) { tn.Nodes.Clear(); Collection <ModuleInfo> modules = ConfigCtrl.GetModules(tn.Template.FullPath); foreach (ModuleInfo module in modules) { ModuleNode xn = new ModuleNode(module.ModuleName); xn.Module = module; tn.Nodes.Add(xn); } } }
private void OnDeleteTemplateClick(object o, EventArgs e) { try { if (MessageBox.Show("Are you sure?", "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2) == DialogResult.OK) { TemplateNode tn = this.SelectedNode as TemplateNode; if (tn != null && tn.Template != null) { ConfigCtrl.DeleteTemplate(tn.Template); InitialNodes(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, CGConstants.MSG_SYSTEMERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void OnAddModuleClick(object o, EventArgs e) { try { TemplateNode tn = this.SelectedNode as TemplateNode; if (tn != null) { DlgAddModule dlgam = new DlgAddModule(); dlgam.Template = tn.Template; if (dlgam.ShowDialog() == DialogResult.OK) { RefreshTemplateNode(tn); } } } catch (Exception ex) { MessageBox.Show(ex.Message, CGConstants.MSG_SYSTEMERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void InitialNodes() { base.Nodes.Clear(); //build Root node BaseNode Root = new BaseNode("Templates"); base.Nodes.Add(Root); //build Template node Collection<TemplateInfo> templates = ConfigCtrl.GetTemplates(); if (templates != null) { foreach (TemplateInfo item in templates) { TemplateNode tn = new TemplateNode(item.Name); tn.Template = new TemplateInfo(item.FullPath, item.Name); Root.Nodes.Add(tn); RefreshTemplateNode(tn); } } if (Root.Nodes.Count > 0) { Root.Expand(); } }
private void RefreshTemplateNode(TemplateNode tn) { if (tn != null) { tn.Nodes.Clear(); Collection<ModuleInfo> modules = ConfigCtrl.GetModules(tn.Template.FullPath); foreach (ModuleInfo module in modules) { ModuleNode xn = new ModuleNode(module.ModuleName); xn.Module = module; tn.Nodes.Add(xn); } } }