コード例 #1
0
        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();
            }
        }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
        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);
                }
            }
        }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
 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);
     }
 }
コード例 #6
0
ファイル: TemplateTree.cs プロジェクト: jojozhuang/Projects
        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();
            }
        }
コード例 #7
0
ファイル: TemplateTree.cs プロジェクト: jojozhuang/Projects
        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);
                }
            }
        }