Пример #1
0
        private void ToolStripMenuItemAddPropertyFolder_Click(object sender, EventArgs e)
        {
            EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode;
            PlantStructureFolderForm plantstructurefolderform = new PlantStructureFolderForm();

            //plantstructureobjectform.isfolder = true;
            //plantstructureobjectform.title = "Plant Structure Object Folder";
            if (plantstructurefolderform.ShowDialog() == DialogResult.OK)
            {
                tblPlantStructure tblplantstructure = new tblPlantStructure();
                tblplantstructure.Name        = plantstructurefolderform.name;
                tblplantstructure.Description = plantstructurefolderform.description;
                tblplantstructure.Type        = (int)TREE_NODE_TYPE.PropertyFolder;
                tblplantstructure.ParentID    = node.NodeID;
                tblplantstructure.SolutionID  = tblSolution.m_tblSolution().SolutionID;
                tblplantstructure.IsFolder    = true;
                tblplantstructure.IsObject    = false;
                tblplantstructure.Visible     = true;
                int ret = tblplantstructure.Insert();
                if (ret == 0)
                {
                    EWSTreeNode childnode = new EWSTreeNode(tblplantstructure.Name);
                    childnode.NodeID             = tblplantstructure.ID;
                    childnode.sqlobject          = tblplantstructure;
                    childnode.ContextMenuStrip   = contextMenuStripStructure;
                    childnode.ImageIndex         = 1;
                    childnode.SelectedImageIndex = 1;
                    childnode.Nodetype           = (TREE_NODE_TYPE)tblplantstructure.Type;
                    node.Nodes.Add(childnode);
                }
                UpdateTabPage();
            }
        }
Пример #2
0
        private void LCUSelectForm_Load(object sender, EventArgs e)
        {
            EWSTreeNode node;
            EWSTreeNode node2;

            node = new EWSTreeNode(tblSolution.m_tblSolution().SolutionName);

            node.ImageIndex         = 0;
            node.SelectedImageIndex = 1;
            node.Nodetype           = TREE_NODE_TYPE.ROOT;
            treeViewControl.Nodes.Add(node);


            foreach (tblController tblcontroller in tblSolution.m_tblSolution().m_tblControllerCollection)
            {
                if (tblcontroller.type == 0)
                {
                    node2            = new EWSTreeNode(tblcontroller.ControllerName);
                    node2.ImageIndex = 16;
                    node2.NodeID     = tblcontroller.ControllerID;
                    node2.Nodetype   = TREE_NODE_TYPE.CONTROLLER;
                    node.Nodes.Add(node2);
                }
            }
        }
Пример #3
0
        void AddNodeToPlantStructureTree(EWSTreeNode parentnode, long id)
        {
            EWSTreeNode childnode;
            List <tblPlantStructure> nodes = tblSolution.m_tblSolution().GetPlantStructure(id);

            foreach (tblPlantStructure tblplantstructure in nodes)
            {
                if (!tblplantstructure.Visible)
                {
                    continue;
                }
                childnode           = new EWSTreeNode(tblplantstructure.Name);
                childnode.NodeID    = tblplantstructure.ID;
                childnode.sqlobject = tblplantstructure;

                if (tblplantstructure.IsObject)
                {
                    childnode.ImageIndex         = 2;
                    childnode.SelectedImageIndex = 2;
                    childnode.Nodetype           = (TREE_NODE_TYPE)tblplantstructure.Type;
                }
                else
                {
                    continue;
                }


                parentnode.Nodes.Add(childnode);
                AddNodeToPlantStructureTree(childnode, childnode.NodeID);
            }
        }
Пример #4
0
        private void EditProperty()
        {
            EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode;
            PlantStructurePropertyForm plantstructurepropertyform = new PlantStructurePropertyForm();
            tblPlantStructure          _tblplantstructure         = (tblPlantStructure)node.sqlobject;

            plantstructurepropertyform.name        = _tblplantstructure.Name;
            plantstructurepropertyform.description = _tblplantstructure.Description;
            plantstructurepropertyform.type        = _tblplantstructure.Type;
            plantstructurepropertyform.filename    = _tblplantstructure.PropertyPath;
            plantstructurepropertyform.argument    = _tblplantstructure.Argument;
            if (plantstructurepropertyform.ShowDialog() == DialogResult.OK)
            {
                _tblplantstructure.Name         = plantstructurepropertyform.name;
                _tblplantstructure.Description  = plantstructurepropertyform.description;
                _tblplantstructure.Type         = plantstructurepropertyform.type;
                _tblplantstructure.PropertyPath = plantstructurepropertyform.filename;
                _tblplantstructure.Argument     = plantstructurepropertyform.argument;
                foreach (tblPlantStructure tblplantstructure in tblSolution.m_tblSolution().m_tblPlantStructureCollection)
                {
                    if ((tblplantstructure.Name.ToUpper() == _tblplantstructure.Name.ToUpper()) &&
                        (tblplantstructure.ParentID == _tblplantstructure.ParentID) &&
                        (tblplantstructure.ID != _tblplantstructure.ID))
                    {
                        return;
                    }
                }
                int ret = _tblplantstructure.Update();
                UpdateTabPage();
            }
        }
Пример #5
0
        private void EditFolder()
        {
            EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode;
            PlantStructureFolderForm plantstructurefolderform = new PlantStructureFolderForm();
            tblPlantStructure        _tblplantstructure       = (tblPlantStructure)node.sqlobject;

            plantstructurefolderform.name        = _tblplantstructure.Name;
            plantstructurefolderform.description = _tblplantstructure.Description;
            if (plantstructurefolderform.ShowDialog() == DialogResult.OK)
            {
                _tblplantstructure.Name        = plantstructurefolderform.name;
                _tblplantstructure.Description = plantstructurefolderform.description;
                foreach (tblPlantStructure tblplantstructure in tblSolution.m_tblSolution().m_tblPlantStructureCollection)
                {
                    if ((tblplantstructure.Name.ToUpper() == _tblplantstructure.Name.ToUpper()) &&
                        (tblplantstructure.ParentID == _tblplantstructure.ParentID) &&
                        (tblplantstructure.ID != _tblplantstructure.ID))
                    {
                        return;
                    }
                }
                int ret = _tblplantstructure.Update();
                UpdateTabPage();
            }
        }
Пример #6
0
        private void SaveController_Click(object sender, EventArgs e)
        {
            EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode;

            //EWSTreeNode parentnode;
            if (node != null)
            {
                if (node.Nodetype == TREE_NODE_TYPE.CONTROLLER)
                {
                    foreach (tblController tblcontroller in Global.EWS.m_tblSolution.m_tblControllerCollection)
                    {
                        if (tblcontroller.ControllerID == node.NodeID)
                        {
                            mainEWSFrom.SaveControllerOpenItems(tblcontroller.ControllerID);
                            tblcontroller.SaveDB();
                            Compiler compiler = new Compiler(mainEWSFrom);
                            foreach (tblPou tblpou in tblcontroller.m_tblPouCollection)
                            {
                                if (tblpou.pouName != "GLOBAL")
                                {
                                    compiler.CompilePOU(tblcontroller, tblpou);
                                }
                            }
                            break;
                        }
                    }
                }
            }
        }
        private void treeViewControl_DoubleClick(object sender, EventArgs e)
        {
            EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode;

            //EWSTreeNode parentnode;
            if (node.Nodetype == TREE_NODE_TYPE.DISPLAY)
            {
                if (!mainEWSFrom.CheckDocIsOpen(TABPAGETYPE.DISPLAY, node.NodeID))
                {
                    TabDisplayPageControl tabpagecontrol = new TabDisplayPageControl(mainEWSFrom, node.NodeID);
                    tabpagecontrol.TitleText = node.Text;
                    foreach (tblDisplay tbldisplay in Global.EWS.m_tblSolution.m_tblDisplayCollection)
                    {
                        if (tbldisplay.DisplayID == node.NodeID)
                        {
                            mainEWSFrom.m_propertyGrid.SelectedObject = tabpagecontrol.drawarea;// tbldisplay;
                            //mainEWSForm.m_propertyGrid.HiddenProperties = o.PropertyGridFilterH();
                            //mainEWSForm.m_propertyGrid.BrowsableProperties = o.PropertyGridFilterS();
                            //mainEWSForm.m_propertyGrid.Refresh();

                            //
                            tabpagecontrol.drawarea.ID = tbldisplay.DisplayID;
                            tbldisplay.InitGraphic(tabpagecontrol.drawarea.Pages.GraphicPagesList[0]);
                            tabpagecontrol.drawarea.BackColor = tbldisplay.BackColor;
                            tabpagecontrol.drawarea.Size      = new System.Drawing.Size(1280, 830);
                            mainEWSFrom.ShowTabPage(tabpagecontrol);
                            break;
                        }
                    }
                }
            }
        }
Пример #8
0
 private void compilePOUToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         EWSTreeNode node  = (EWSTreeNode)treeViewControl.SelectedNode;
         long        pouid = ((EWSTreeNode)node).NodeID;
         //bool ret = false;
         Compiler compiler = new Compiler(/*mainform*/);
         tblPou   tblpou   = tblSolution.m_tblSolution().GetPouFromID(pouid);
         string   filename;
         if (tblpou.Language == PouLanguageType.ST)
         {
             filename  = Common.ProjectPath + "\\LOGIC";
             filename += "\\";
             filename += tblSolution.m_tblSolution().GetControllerobjectofPOUID(tblpou.pouID).ControllerName;
             filename += "\\";
             filename += tblpou.pouName + ".st";
             using (StreamWriter writer = new StreamWriter(filename))
             {
                 writer.WriteLine(tblpou.STText);
                 writer.Close();
             }
         }
         compiler.CompilePOU(tblSolution.m_tblSolution().GetPouFromID(pouid));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        public override bool Initialize()
        {
            bool        ret = true;
            EWSTreeNode rootnode;
            EWSTreeNode displaynode;

            rootnode = new EWSTreeNode(Common.DatabaseName);

            rootnode.ImageIndex         = 0;
            rootnode.SelectedImageIndex = 1;
            AddRoot(rootnode);

            List <tblDisplay> currentDisplays = Global.EWS.m_tblSolution.GetDisplays(0);

            AddDisplaytoTree(currentDisplays, 0, rootnode);
            //foreach (tblDisplay tbldisplay in Global.EWS.m_tblSolution.m_tblDisplayCollection)
            //{
            //    if (tbldisplay.ParrentDisplay == 0)
            //    {
            //        displaynode = new EWSTreeNode(tbldisplay.DisplayName);
            //        displaynode.NodeID = tbldisplay.DisplayID;
            //        displaynode.Nodetype = TREE_NODE_TYPE.DISPLAY;
            //        displaynode.ContextMenuStrip = contextMenuStripDisplay;
            //        displaynode.ImageIndex = 6;
            //        displaynode.SelectedImageIndex = 7;
            //        rootnode.Nodes.Add(displaynode);
            //    }
            //    else
            //    {
            //        AddNodeToDisplayTree(tbldisplay, 0, displaynode);
            //    }
            //}
            return(ret);
        }
Пример #10
0
        private void compilePOUToolStripMenuItem_Click(object sender, EventArgs e)
        {
            EWSTreeNode node  = (EWSTreeNode)treeViewControl.SelectedNode;
            long        pouid = ((EWSTreeNode)node).NodeID;
            //bool ret = false;
            Compiler compiler = new Compiler(mainEWSFrom);

            compiler.CompilePOU(Global.EWS.m_tblSolution.GetPouFromID(pouid));
        }
Пример #11
0
        void AddNodeToPlantStructureTree(EWSTreeNode parentnode, long id)
        {
            EWSTreeNode childnode;
            List <tblPlantStructure> nodes = tblSolution.m_tblSolution().GetPlantStructure(id);

            foreach (tblPlantStructure tblplantstructure in nodes)
            {
                childnode        = new EWSTreeNode(tblplantstructure.Name);
                childnode.NodeID = tblplantstructure.ID;
                if (!NodeisAvaialble(childnode.NodeID))
                {
                    childnode.ForeColor = SystemColors.GrayText;
                }
                switch (tblplantstructure.Type)
                {
                case 2:
                    childnode.ImageIndex         = 1;
                    childnode.SelectedImageIndex = 1;
                    childnode.Nodetype           = TREE_NODE_TYPE.Area;
                    break;

                case 3:
                    childnode.ImageIndex         = 2;
                    childnode.SelectedImageIndex = 2;
                    childnode.Nodetype           = TREE_NODE_TYPE.Zone;
                    break;

                case 4:
                    childnode.ImageIndex         = 3;
                    childnode.SelectedImageIndex = 3;
                    childnode.Nodetype           = TREE_NODE_TYPE.Unit;
                    break;

                case 5:
                    childnode.ImageIndex         = 4;
                    childnode.SelectedImageIndex = 4;
                    childnode.Nodetype           = TREE_NODE_TYPE.Package;
                    break;

                case 6:
                    childnode.ImageIndex         = 5;
                    childnode.SelectedImageIndex = 5;
                    childnode.Nodetype           = TREE_NODE_TYPE.LCU;
                    break;

                case 7:
                    childnode.ImageIndex         = 6;
                    childnode.SelectedImageIndex = 6;
                    childnode.Nodetype           = TREE_NODE_TYPE.OWS;
                    break;
                }

                parentnode.Nodes.Add(childnode);
                AddNodeToPlantStructureTree(childnode, childnode.NodeID);
            }
        }
Пример #12
0
        void AddNodeToPlantStructureTree(EWSTreeNode parentnode, long id)
        {
            EWSTreeNode childnode;
            List <tblPlantStructure> nodes = Global.EWS.m_tblSolution.GetPlantStructure(id);

            foreach (tblPlantStructure tblplantstructure in nodes)
            {
                childnode        = new EWSTreeNode(tblplantstructure.Name);
                childnode.NodeID = tblplantstructure.ID;
                switch (tblplantstructure.Type)
                {
                case 2:
                    childnode.ImageIndex         = 1;
                    childnode.SelectedImageIndex = 1;
                    childnode.Nodetype           = TREE_NODE_TYPE.Area;
                    break;

                case 3:
                    childnode.ImageIndex         = 2;
                    childnode.SelectedImageIndex = 2;
                    childnode.Nodetype           = TREE_NODE_TYPE.Zone;
                    break;

                case 4:
                    childnode.ImageIndex         = 3;
                    childnode.SelectedImageIndex = 3;
                    childnode.Nodetype           = TREE_NODE_TYPE.Unit;
                    break;

                case 5:
                    childnode.ImageIndex         = 4;
                    childnode.SelectedImageIndex = 4;
                    childnode.Nodetype           = TREE_NODE_TYPE.Package;
                    break;

                case 6:
                    childnode.ImageIndex         = 5;
                    childnode.SelectedImageIndex = 5;
                    childnode.Nodetype           = TREE_NODE_TYPE.LCU;
                    break;

                case 7:
                    childnode.ImageIndex         = 6;
                    childnode.SelectedImageIndex = 6;
                    childnode.Nodetype           = TREE_NODE_TYPE.OWS;
                    break;
                }


                childnode.ContextMenuStrip = contextMenuStripStructure;

                parentnode.Nodes.Add(childnode);
                AddNodeToPlantStructureTree(childnode, childnode.NodeID);
            }
        }
Пример #13
0
        private void CompileController_Click(object sender, EventArgs e)
        {
            EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode;

            if (node != null)
            {
                if (node.Nodetype == TREE_NODE_TYPE.CONTROLLER)
                {
                    mainEWSFrom.CompileController(Global.EWS.m_tblSolution.GetControllerFromID(node.NodeID));
                }
            }
        }
Пример #14
0
        private void CompileController_Click(object sender, EventArgs e)
        {
            EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode;

            if (node != null)
            {
                if (node.Nodetype == TREE_NODE_TYPE.CONTROLLER)
                {
                    MainForm.Instance().CompileController(tblSolution.m_tblSolution().GetControllerFromID(node.NodeID));
                }
            }
        }
Пример #15
0
        private void DeletePOU_Click(object sender, EventArgs e)
        {
            EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode;

            if (node != null)
            {
                if (node.Nodetype == TREE_NODE_TYPE.PROGRAM)
                {
                    tblPou tblpou = new tblPou();
                    tblpou.pouID = node.NodeID;
                    tblpou.Delete();
                }
            }
        }
Пример #16
0
        private void ToolStripMenuItemDelete_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure?", "Warning", MessageBoxButtons.YesNo);

            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode;
                treeViewControl.SelectedNode = (EWSTreeNode)node.Parent;
                DeleteNodeFromDatabase(node);
                ((tblPlantStructure)node.sqlobject).Delete();
                treeViewControl.Nodes.Remove(treeViewControl.SelectedNode);
                UpdateTabPage();
            }
        }
Пример #17
0
 void DeleteNodeFromDatabase(EWSTreeNode treenode)
 {
     if (treenode.Nodes.Count == 0)
     {
         ((tblPlantStructure)treenode.sqlobject).Delete();
         return;
     }
     else
     {
         foreach (EWSTreeNode node in treenode.Nodes)
         {
             DeleteNodeFromDatabase(node);
         }
     }
 }
Пример #18
0
        private void treeView1_DoubleClick(object sender, EventArgs e)
        {
            EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode;

            if (node != null)
            {
                if (node.Nodetype == TREE_NODE_TYPE.ROOT)
                {
                }

                if (node.Nodetype == TREE_NODE_TYPE.CONTROLLER)
                {
                }
            }
        }
Пример #19
0
        void Initialize()
        {
            //bool ret = true;
            EWSTreeNode rootnode;

            //EWSTreeNode displaynode;
            rootnode = new EWSTreeNode(Common.DatabaseName);

            rootnode.ImageIndex         = 0;
            rootnode.SelectedImageIndex = 1;
            treeViewControl.Nodes.Add(rootnode);

            List <tblDisplay> currentDisplays = tblSolution.m_tblSolution().GetDisplays(0);

            AddDisplaytoTree(currentDisplays, 0, rootnode);
        }
Пример #20
0
        bool Initialize()
        {
            bool        ret = true;
            EWSTreeNode rootnode;
            EWSTreeNode childnode;

            rootnode = new EWSTreeNode(Common.DatabaseName);

            rootnode.ImageIndex         = 0;
            rootnode.SelectedImageIndex = 0;
            rootnode.Nodetype           = TREE_NODE_TYPE.Root;
            rootnode.sqlobject          = tblSolution.m_tblSolution();
            treeViewControl.Nodes.Add(rootnode);
            long _parentid = -1;
            List <tblPlantStructure> nodes = tblSolution.m_tblSolution().GetPlantStructure(_parentid);


            foreach (tblPlantStructure tblplantstructure in nodes)
            {
                if (!tblplantstructure.Visible)
                {
                    continue;
                }
                childnode           = new EWSTreeNode(tblplantstructure.Name);
                childnode.NodeID    = tblplantstructure.ID;
                childnode.sqlobject = tblplantstructure;


                if (tblplantstructure.IsObject)
                {
                    childnode.ImageIndex         = 2;
                    childnode.SelectedImageIndex = 2;
                    childnode.Nodetype           = (TREE_NODE_TYPE)tblplantstructure.Type;
                }
                else
                {
                    continue;
                }



                rootnode.Nodes.Add(childnode);
                AddNodeToPlantStructureTree(childnode, childnode.NodeID);
            }
            return(ret);
        }
        void AddNodeToDisplayTree(tblDisplay _tbldisplay, long _parentid, EWSTreeNode parentewstreenode)
        {
            if (_parentid > 0)
            {
                List <tblDisplay> currentDisplays = Global.EWS.m_tblSolution.GetDisplays(_parentid);

                for (int i = 0; i < currentDisplays.Count; i++)
                {
                    if (currentDisplays[i].oIndex != i)
                    {
                        currentDisplays[i].oIndex = i;
                        currentDisplays[i].Update();
                    }
                }

                foreach (tblDisplay tbldisplay in currentDisplays)
                {
                    if (tbldisplay.IsDisplay)
                    {
                        EWSTreeNode node0 = new EWSTreeNode(tbldisplay.DisplayName);
                        node0.NodeID = tbldisplay.DisplayID;

                        node0.Nodetype           = TREE_NODE_TYPE.DISPLAY;
                        node0.ContextMenuStrip   = contextMenuStripDisplay;
                        node0.ImageIndex         = 3;
                        node0.SelectedImageIndex = 4;

                        parentewstreenode.Nodes.Add(node0);
                    }

                    else
                    {
                        EWSTreeNode node0 = new EWSTreeNode(tbldisplay.DisplayName);
                        node0.NodeID = tbldisplay.DisplayID;

                        node0.Nodetype           = TREE_NODE_TYPE.DISPALYGROUP;
                        node0.ContextMenuStrip   = contextMenuStripFolder;
                        node0.ImageIndex         = 2;
                        node0.SelectedImageIndex = 3;

                        parentewstreenode.Nodes.Add(node0);
                        //AddNodeToDisplayTree(_domain, tbldisplay.DisplayID, node0);
                    }
                }
            }
        }
Пример #22
0
        private void DeleteUD(TREE_NODE_TYPE _tree_node_type)
        {
            EWSTreeNode node         = (EWSTreeNode)treeViewControl.SelectedNode;
            string      name         = node.Text.ToUpper();
            tblFunction _tblfunction = null;
            tblPou      _tblpou      = null;

            if (node != null)
            {
                if (node.Nodetype == _tree_node_type)
                {
                    foreach (tblFunction tblfunction in tblSolution.m_tblSolution().m_tblFunctionCollection)
                    {
                        if (tblfunction.FunctionName.ToUpper() == name)
                        {
                            _tblfunction = tblfunction;
                            tblSolution.m_tblSolution().functionbyType.Remove(_tblfunction.Type);
                            tblSolution.m_tblSolution().functionbyName.Remove(_tblfunction.FunctionName);
                            break;
                        }
                    }
                    if (_tblfunction != null)
                    {
                        tblSolution.m_tblSolution().m_tblFunctionCollection.Remove(_tblfunction);
                        _tblfunction.Delete();
                    }
                    foreach (tblPou tblpou in tblSolution.m_tblSolution().Dummytblcontroller.m_tblPouCollection)
                    {
                        if (tblpou.pouName.ToUpper() == name)
                        {
                            _tblpou = tblpou;
                            break;
                        }
                    }
                    if (_tblpou != null)
                    {
                        //tblSolution.m_tblSolution().Dummytblcontroller.m_tblPouCollection.Remove(_tblpou);
                        _tblpou.Delete();
                    }
                }
                treeViewControl.Nodes.Remove(treeViewControl.SelectedNode);
            }
        }
Пример #23
0
        private void ToolStripMenuItemEdit_Click(object sender, EventArgs e)
        {
            EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode;

            if (((tblPlantStructure)node.sqlobject).IsObject)
            {
            }
            else
            {
                if (((tblPlantStructure)node.sqlobject).IsFolder)
                {
                    EditFolder();
                }
                else
                {
                    EditProperty();
                }
            }
        }
Пример #24
0
        void AddDisplaytoTree(List <tblDisplay> currentDisplays, long ID, EWSTreeNode parentewstreenode)
        {
            foreach (tblDisplay tbldisplay in currentDisplays)
            {
                EWSTreeNode node0 = new EWSTreeNode(tbldisplay.DisplayName);
                node0.NodeID = tbldisplay.DisplayID;

                node0.Nodetype           = TREE_NODE_TYPE.DISPLAY;
                node0.ContextMenuStrip   = contextMenuStripDisplay;
                node0.ImageIndex         = 3;
                node0.SelectedImageIndex = 4;
                {
                    List <tblDisplay> childDisplays = tblSolution.m_tblSolution().GetDisplays(tbldisplay.DisplayID);
                    if (childDisplays.Count > 0)
                    {
                        AddDisplaytoTree(childDisplays, tbldisplay.DisplayID, node0);
                    }
                }
                parentewstreenode.Nodes.Add(node0);
            }
        }
Пример #25
0
        private void AddPOU(EWSTreeNode node, PROGRAM_IMAGELIST program_imagelist, int imageindex)
        {
            long   ID     = ((EWSTreeNode)node).NodeID;
            tblPou tblpou = new tblPou();

            tblpou.pouName      = Global.EWS.m_tblSolution.GetControllerFromID(ID).GetNewPOUName();
            tblpou.Language     = (PouLanguageType)program_imagelist;
            tblpou.ControllerID = ID;
            tblpou.oIndex       = 0xffffff;
            tblpou.Insert();
            EWSTreeNode newnode = new EWSTreeNode(tblpou.pouName);

            newnode.NodeID             = tblpou.pouID;
            newnode.ImageIndex         = imageindex;
            newnode.SelectedImageIndex = imageindex;
            newnode.ContextMenuStrip   = contextMenuStripPOU;
            node.Nodes.Add(newnode);
            Global.EWS.m_tblSolution.GetControllerFromID(ID).ResetCollection();
            Global.EWS.m_tblSolution.GetControllerFromID(ID).m_tblPouCollection = null;
            Global.EWS.m_tblSolution.GetControllerFromID(ID).ReindexPOUs();
        }
Пример #26
0
        private void treeViewControl_DoubleClick(object sender, EventArgs e)
        {
            EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode;

            if (node.Nodetype == TREE_NODE_TYPE.DISPLAY)
            {
                if (!MainForm.Instance().CheckDocIsOpen(TABPAGETYPE.DISPLAY, node.NodeID))
                {
                    foreach (tblDisplay tbldisplay in tblSolution.m_tblSolution().m_tblDisplayCollection)
                    {
                        if (tbldisplay.DisplayID == node.NodeID)
                        {
                            TabDisplayPageControl tabdisplaypagecontrol = new TabDisplayPageControl(node.NodeID);
                            tabdisplaypagecontrol.TitleText = node.Text;

                            //tabdisplaypagecontrol.ID = tbldisplay.DisplayID;

                            tabdisplaypagecontrol.LoadTabPage();
                            MainForm.Instance().m_propertyGrid.SelectedObject = tabdisplaypagecontrol.Displayobject;// tbldisplay;
                            tabdisplaypagecontrol.drawarea.SnapEnable = false;
                            tabdisplaypagecontrol.drawarea.Size       = new System.Drawing.Size(tbldisplay.Width, tbldisplay.Height);
                            tabdisplaypagecontrol.drawarea.Invalidate();

                            MainForm.Instance().ShowTabPage(tabdisplaypagecontrol);
                            tabdisplaypagecontrol.drawarea.Initialize();
                            tabdisplaypagecontrol.drawarea.Refresh();
                            MainForm.Instance().UpdateToolbox();
                            MainForm.Instance().UpdateLayer(tbldisplay);

                            //MainForm.Instance().m_propertyGrid.SelectedObject = tabdisplaypagecontrol.drawarea;// tbldisplay;
                            //mainEWSForm.m_propertyGrid.HiddenProperties = o.PropertyGridFilterH();
                            //mainEWSForm.m_propertyGrid.BrowsableProperties = o.PropertyGridFilterS();
                            //mainEWSForm.m_propertyGrid.Refresh();

                            break;
                        }
                    }
                }
            }
        }
Пример #27
0
        private void moveUpPOU_Click(object sender, EventArgs e)
        {
            EWSTreeNode node         = (EWSTreeNode)treeViewControl.SelectedNode;
            long        pouid        = ((EWSTreeNode)node).NodeID;
            long        controllerid = ((EWSTreeNode)node.Parent).NodeID;
            tblPou      tblpou       = tblSolution.m_tblSolution().GetControllerFromID(controllerid).GetPouFromID(pouid);

            if (tblpou.oIndex > 1)
            {
                tblSolution.m_tblSolution().GetControllerFromID(controllerid).MoveUpPOU(tblpou.oIndex);
                TreeNode parent = node.Parent;
                if (parent != null)
                {
                    int index = parent.Nodes.IndexOf(node);
                    if (index > 0)
                    {
                        parent.Nodes.RemoveAt(index);
                        parent.Nodes.Insert(index - 1, node);
                    }
                }
            }
        }
Пример #28
0
        private void moveDownPOU_Click(object sender, EventArgs e)
        {
            EWSTreeNode node         = (EWSTreeNode)treeViewControl.SelectedNode;
            long        pouid        = ((EWSTreeNode)node).NodeID;
            long        controllerid = ((EWSTreeNode)node.Parent).NodeID;
            tblPou      tblpou       = Global.EWS.m_tblSolution.GetControllerFromID(controllerid).GetPouFromID(pouid);

            if (tblpou.oIndex != (Global.EWS.m_tblSolution.GetControllerFromID(controllerid).m_tblPouCollection.Count - 1))
            {
                Global.EWS.m_tblSolution.GetControllerFromID(controllerid).MoveDownPOU(tblpou.oIndex);
                TreeNode parent = node.Parent;
                if (parent != null)
                {
                    int index = parent.Nodes.IndexOf(node);
                    if (index < parent.Nodes.Count - 1)
                    {
                        parent.Nodes.RemoveAt(index);
                        parent.Nodes.Insert(index + 1, node);
                    }
                }
            }
        }
Пример #29
0
        //private void updateControllerChangeEventhandler(object sender, EventArgs e)
        //{
        //    this.treeViewControl.Nodes.Clear();
        //    Initialize();
        //}

        private void Initialize()
        {
            // bool ret = true;
            EWSTreeNode node;
            EWSTreeNode node1;
            EWSTreeNode node2;
            EWSTreeNode node3;
            EWSTreeNode node4;


            node = new EWSTreeNode(tblSolution.m_tblSolution().SolutionName);
            node.ContextMenuStrip   = contextMenuStripProject;
            node.ImageIndex         = 0;
            node.SelectedImageIndex = 0;
            node.Nodetype           = TREE_NODE_TYPE.ROOT;
            treeViewControl.Nodes.Add(node);

            node2                    = new EWSTreeNode("General");
            node2.ImageIndex         = 1;
            node2.SelectedImageIndex = 1;
            node2.NodeID             = -1;
            node2.Nodetype           = TREE_NODE_TYPE.GENERAL;
            node.Nodes.Add(node2);

            node3                    = new EWSTreeNode("Alarm Group");
            node3.ImageIndex         = 1;
            node3.SelectedImageIndex = 1;
            node3.NodeID             = -1;
            node3.Nodetype           = TREE_NODE_TYPE.ALARM_GROUP;
            node2.Nodes.Add(node3);

            node1                    = new EWSTreeNode("Controllers");
            node1.ImageIndex         = 1;
            node1.SelectedImageIndex = 1;
            node1.NodeID             = -1;
            node1.Nodetype           = TREE_NODE_TYPE.FCS_Group;
            node.Nodes.Add(node1);

            foreach (tblController tblcontroller in tblSolution.m_tblSolution().m_tblControllerCollection)
            {
                if (tblcontroller.type == 0)
                {
                    node2 = new EWSTreeNode(tblcontroller.ControllerName);
                    node2.ContextMenuStrip   = contextMenuStripController;
                    node2.ImageIndex         = 1;
                    node2.SelectedImageIndex = 1;
                    node2.NodeID             = tblcontroller.ControllerID;
                    node2.Nodetype           = TREE_NODE_TYPE.CONTROLLER;
                    node1.Nodes.Add(node2);

                    node3 = new EWSTreeNode("Variables");
                    node3.ContextMenuStrip   = contextMenuStripVariable;
                    node3.ImageIndex         = 2;
                    node3.SelectedImageIndex = 2;
                    node3.Nodetype           = TREE_NODE_TYPE.VARIABLE;
                    node3.NodeID             = tblcontroller.ControllerID;
                    node2.Nodes.Add(node3);

                    node4 = new EWSTreeNode("IO Boards");
                    node4.ContextMenuStrip   = contextMenuStripVariable;
                    node4.ImageIndex         = 2;
                    node4.SelectedImageIndex = 2;
                    node4.NodeID             = tblcontroller.ControllerID;
                    node4.Nodetype           = TREE_NODE_TYPE.IORACK;
                    node2.Nodes.Add(node4);

                    foreach (tblBoard tblboard in tblcontroller.m_tblBoardCollection)
                    {
                        node3 = new EWSTreeNode(tblboard.BoardName);
                        //node3.ContextMenuStrip = contextMenuStripIORack;
                        node3.ImageIndex         = 2;
                        node3.SelectedImageIndex = 2;
                        node3.NodeID             = tblboard.BoardID;
                        node4.Nodes.Add(node3);
                    }
                }
            }
        }
Пример #30
0
        private void treeViewControl_DoubleClick(object sender, EventArgs e)
        {
            EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode;
            EWSTreeNode parentnode;

            if (node != null)
            {
                if (node.Nodetype == TREE_NODE_TYPE.VARIABLE)
                {
                    TabVariableGridPageControl tabpagecontrol;
                    do
                    {
                        parentnode = (EWSTreeNode)node.Parent;
                        node       = parentnode;
                    } while (parentnode.Nodetype != TREE_NODE_TYPE.CONTROLLER);
                    node = (EWSTreeNode)treeViewControl.SelectedNode;
                    if (!MainForm.Instance().CheckDocIsOpen(TABPAGETYPE.VARIABLE, node.NodeID))
                    {
                        tabpagecontrol           = new TabVariableGridPageControl(node.NodeID);
                        tabpagecontrol.TitleText = node.Parent.Text;//"FCS";
                        tabpagecontrol.LoadTabPage();
                        MainForm.Instance().ShowTabPage(tabpagecontrol);
                        tabpagecontrol.SetColumns();
                        tabpagecontrol.ClearSelection();
                    }
                }
                //if (node.Nodetype == TREE_NODE_TYPE.IORACK)
                //{

                //    do
                //    {
                //        parentnode = (EWSTreeNode)node.Parent;
                //        node = parentnode;

                //    } while (parentnode.Nodetype != TREE_NODE_TYPE.CONTROLLER);
                //    node = (EWSTreeNode)treeViewControl.SelectedNode;
                //    TabPageControl tabpagecontrol1 = new TabPageControl(mainform, node.NodeID);
                //    tabpagecontrol1.TitleText = node.Parent.Text;//"FCS";
                //    tabpagecontrol1.LoadTabPage();
                //    mainform.addPanel(tabpagecontrol1);


                //}
                if (node.Nodetype == TREE_NODE_TYPE.ALARM_GROUP)
                {
                    if (!MainForm.Instance().CheckDocIsOpen(TABPAGETYPE.ALARM_GROUP, tblSolution.m_tblSolution().SolutionID))
                    {
                        TabPageGridAlarmGroupControl tabpagecontrol = new TabPageGridAlarmGroupControl(tblSolution.m_tblSolution().SolutionID);
                        do
                        {
                            parentnode = (EWSTreeNode)node.Parent;
                            node       = parentnode;
                        } while (parentnode.Nodetype != TREE_NODE_TYPE.ROOT);
                        node = (EWSTreeNode)treeViewControl.SelectedNode;
                        tabpagecontrol.TitleText = "Alarm Group";
                        //tabpagecontrol.PageType = TabPageType.ALARM_GROUP;
                        //tabpagecontrol.ID = -1;
                        tabpagecontrol.LoadTabPage();
                        MainForm.Instance().ShowTabPage(tabpagecontrol);
                    }
                }
            }
        }