private void btnNewTemplate_Click(object sender, EventArgs e)
        {
            UCBatchTempalteName uCBatchTempalteName = new UCBatchTempalteName();

            if (uCBatchTempalteName.ShowInContainer() == DialogResult.OK)
            {
                BatchTemplateDef batchTemplate = new BatchTemplateDef();
                batchTemplate.Name = uCBatchTempalteName.TemplateName;
                //根据模板创建树
                BatchTemplateTree templateTree = BatchTemplateTree.CreateTreeFromTemplate(batchTemplate);

                //在右边视图中重新生成树
                this._splitContainer1.Panel2.Controls.Clear();
                currentTemplateTree = templateTree;
                this._splitContainer1.Panel2.Controls.Add(currentTemplateTree.GetRadTreeView());
                this._splitContainer1.Panel2.Refresh();
                //currentTemplateTree.Refresh();

                //列表中添加新项,并保存树
                ListViewItem listViewItem = new ListViewItem(uCBatchTempalteName.TemplateName);
                listViewItem.Tag = templateTree;
                this._listViewTemplates.Items.Add(listViewItem);
                //this._listViewTemplates.Items.Insert(0, listViewItem);
            }
        }
Exemple #2
0
 public static void AddUpdateTemplate(BatchTemplateDef template)
 {
     if (template != null)
     {
         BatchTemplateMgr._tempates.RemoveAll((BatchTemplateDef o) => o.Name == template.Name);
         BatchTemplateMgr._tempates.Add(template);
         //BatchTemplateMgr.SaveTemplates();
     }
 }
 private void btnSaveTemplate_Click(object sender, EventArgs e)
 {
     BatchTemplateMgr.GetTemplates().Clear();
     foreach (ListViewItem item in this._listViewTemplates.Items)
     {
         BatchTemplateMgr.AddUpdateTemplate(BatchTemplateDef.FromBatchTemplateTree((item.Tag as BatchTemplateTree), item.Text));
     }
     BatchTemplateMgr.SaveTemplates();
 }
        // Methods
        public string FromInputDialog(string param = "")
        {
            FormNewBatchNO hno = new FormNewBatchNO();

            if (hno.ShowDialog() == DialogResult.OK)
            {
                this._selectedtempalte = hno.SelectedBatchtemplate;
                return(hno.BatchNO);
            }
            this._selectedtempalte = null;
            return(string.Empty);
        }
        private void ListView1_DoubleClick(object sender, EventArgs e)
        {
            bool flag = this.listView1.SelectedItems.Count > 0;

            if (flag)
            {
                BatchTemplateDef BatchTemplateDef = this.listView1.SelectedItems[0].Tag as BatchTemplateDef;
                bool             flag2            = BatchTemplateDef != null;
                if (flag2)
                {
                    LibCommon.AppContext.GetInstance().GetVal <CmdDispatcher>(typeof(CmdDispatcher)).ProcessCMD("", null);
                }
            }
        }
Exemple #6
0
        public static BatchTemplateDef FromBatchTemplateTree(BatchTemplateTree templateTree, string templateName)
        {
            BatchTemplateDef template = new BatchTemplateDef();

            template.Name = templateName;
            RadTreeNode treeRootNode = templateTree.GetRadTreeView().Nodes[0];

            if (treeRootNode != null)
            {
                template.RootNode = new TemplateNode()
                {
                    Name = treeRootNode.Text
                };
                template.AddTemplateNodeFromTreeNode(template.RootNode, treeRootNode);
            }
            return(template);
        }
Exemple #7
0
        public RadTreeNode FromBatchTemplate(BatchTemplateDef template, NBatchInfo batchInfo)
        {
            RadTreeNode  batchNode    = null;
            TemplateNode templateRoot = template.RootNode;

            if (templateRoot != null)
            {
                batchNode = CreateBatchNode(batchInfo);
                if (templateRoot.HasChildren())
                {
                    foreach (TemplateNode templateChild in templateRoot.Children)
                    {
                        AddCategoryNodeByTemplateNode(batchNode, templateChild);
                    }
                }
            }
            return(batchNode);
        }
Exemple #8
0
        public static RadTreeNode _CreateTemplateTree(RadTreeView tree, BatchTemplateDef bat, String nodeText)
        {
            RadTreeNode batchNode;

            if (bat == null)
            {
                //RadTreeNode batchNode = NavigateTreeHelper.CreateBatchNode(tree, batchInfo, null);
                batchNode = tree.Nodes.Add(nodeText);
                //tree.Refresh();
                batchNode.Selected = true;
                //result = batchNode;
            }
            else
            {
                LinkedList <TemplateNode> linkedList = new LinkedList <TemplateNode>();
                linkedList.AddLast(bat.RootNode);
                batchNode = tree.Nodes.Add(nodeText);
                //RadTreeNode batchNode = NavigateTreeHelper.CreateBatchNode(tree, batchInfo, null);
                tree.Refresh();
                bat.RootNode.Tag = batchNode;
                while (linkedList.Count > 0)
                {
                    TemplateNode value = linkedList.First.Value;
                    if (value.Children != null && value.Children.Count > 0)
                    {
                        RadTreeNode radTreeNode3 = value.Tag as RadTreeNode;
                        foreach (TemplateNode current in value.Children)
                        {
                            RadTreeNode radTreeNode4 = radTreeNode3.Nodes.Add(current.Name);
                            radTreeNode4.ShowCheckBox = false;
                            radTreeNode4.Tag          = new NCategoryInfo(current.Name);
                            current.Tag = radTreeNode4;
                            linkedList.AddLast(current);
                        }
                    }
                    linkedList.RemoveFirst();
                }
                batchNode.ExpandAll();
                batchNode.Selected = true;
            }
            return(batchNode);
        }
Exemple #9
0
 public static RadTreeNode CreateRadTreeFromTemplate(RadTreeView tree, BatchTemplateDef template)
 {
     return(null);
 }