Exemplo n.º 1
0
        private void treeViewControl_DoubleClick(object sender, EventArgs e)
        {
            //TabPageControl tabpagecontrol;
            EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode;
            EWSTreeNode parentnode;

            if (node != null)
            {
                if (node.Nodetype == TREE_NODE_TYPE.PROGRAM)
                {
                    do
                    {
                        parentnode = (EWSTreeNode)node.Parent;
                        node       = parentnode;
                    } while (parentnode.Nodetype != TREE_NODE_TYPE.CONTROLLER);
                    node = (EWSTreeNode)treeViewControl.SelectedNode;
                    foreach (tblController tblcontroller in Global.EWS.m_tblSolution.m_tblControllerCollection)
                    {
                        foreach (tblPou tblpou in tblcontroller.m_tblPouCollection)
                        {
                            if (tblpou.pouID == node.NodeID)
                            {
                                switch ((PROGRAM_LANGUAGE)tblpou.Language)
                                {
                                case PROGRAM_LANGUAGE.ENUM_PROGRAM_LANGUAGE_FBD:
                                    TabFBDPageControl tabfbdpagecontrol = new TabFBDPageControl(mainEWSFrom, tblpou.pouID);

                                    // tabfbdpagecontrol.ImageIndex = 0;
                                    tabfbdpagecontrol.TitleText = node.Text;

                                    //tabpagecontrol.ID = node.NodeID;
                                    //((TabFBDPageControl)tabpagecontrol).ID = tblpou.pouID;
                                    //tabpagecontrol.ControllerID = tblcontroller.ControllerID;

                                    //tabpagecontrol.PageType = TabPageType.FBD;
                                    tabfbdpagecontrol.LoadTabPage();
                                    mainEWSFrom.m_propertyGrid.SelectedObject = tabfbdpagecontrol.drawarea;    // tbldisplay;
                                    //mainEWSForm.m_propertyGrid.HiddenProperties = o.PropertyGridFilterH();
                                    //mainEWSForm.m_propertyGrid.BrowsableProperties = o.PropertyGridFilterS();
                                    //mainEWSForm.m_propertyGrid.Refresh();

                                    //
                                    tabfbdpagecontrol.drawarea.ID = tblpou.pouID;
                                    //tblpou.InitPOU(tabpagecontrol.drawarea.graphicsList);

                                    //tabpagecontrol.drawarea.Size = new System.Drawing.Size(1654,1169);
                                    tabfbdpagecontrol.drawarea.Size = new System.Drawing.Size(1454, 969);
                                    tabfbdpagecontrol.drawarea.Invalidate();
                                    //tbldisplay.InitGraphic(ref graphicslist);
                                    mainEWSFrom.addPanel(tabfbdpagecontrol);
                                    break;

                                case PROGRAM_LANGUAGE.ENUM_PROGRAM_LANGUAGE_SFC:
                                    TabSFCPageControl tabsfcpagecontrol = new TabSFCPageControl(mainEWSFrom, tblpou.pouID);
                                    //tabpagecontrol.PageType = TabPageType.SFC;
                                    mainEWSFrom.addPanel(tabsfcpagecontrol);
                                    break;

                                case PROGRAM_LANGUAGE.ENUM_PROGRAM_LANGUAGE_ST:
                                    TabSTPageControl tabstpagecontrol = new TabSTPageControl(mainEWSFrom, tblpou.pouID);
                                    //  tabstpagecontrol.ImageIndex = 0;
                                    tabstpagecontrol.TitleText = node.Text;
                                    tabstpagecontrol.LoadTabPage();
                                    mainEWSFrom.addPanel(tabstpagecontrol);
                                    break;
                                }


                                return;
                                //break;
                            }
                        }
                    }

                    //mainEWSFrom.addPanel(tabpagecontrol);
                    //_drawingdoc.Text = node.Text;

                    //frm.ShowDocumnet(_drawingdoc);
                }
            }
        }
Exemplo n.º 2
0
        private void treeViewControl_DoubleClick(object sender, EventArgs e)
        {
            //TabPageControl tabpagecontrol;
            EWSTreeNode node = (EWSTreeNode)treeViewControl.SelectedNode;
            EWSTreeNode parentnode;

            if (node != null)
            {
                switch (node.Nodetype)
                {
                case TREE_NODE_TYPE.PROGRAM:
                    #region PROGRAM
                    do
                    {
                        parentnode = (EWSTreeNode)node.Parent;
                        node       = parentnode;
                    } while (parentnode.Nodetype != TREE_NODE_TYPE.CONTROLLER);
                    node = (EWSTreeNode)treeViewControl.SelectedNode;
                    foreach (tblController tblcontroller in tblSolution.m_tblSolution().m_tblControllerCollection)
                    {
                        if (tblcontroller.type == (int)StationType.LCU)
                        {
                            foreach (tblPou tblpou in tblcontroller.m_tblPouCollection)
                            {
                                if (tblpou.pouID == node.NodeID)
                                {
                                    switch ((PROGRAM_LANGUAGE)tblpou.Language)
                                    {
                                    case PROGRAM_LANGUAGE.ENUM_PROGRAM_LANGUAGE_FBD:

                                        if (!MainForm.Instance().CheckDocIsOpen(TABPAGETYPE.FBD, tblpou.pouID))
                                        {
                                            TabFBDPageControl tabfbdpagecontrol = new TabFBDPageControl(tblpou.pouID);
                                            tabfbdpagecontrol.TitleText = node.Text;
                                            tabfbdpagecontrol.LoadTabPage();
                                            tabfbdpagecontrol.UpdateToolstripNavigation();
                                            MainForm.Instance().m_propertyGrid.SelectedObject = tabfbdpagecontrol.PouObject;
                                            MainForm.Instance().m_propertyGrid.HiddenProperties = tabfbdpagecontrol.PouObject.PropertyGridFilterH();
                                            MainForm.Instance().m_propertyGrid.BrowsableProperties = tabfbdpagecontrol.PouObject.PropertyGridFilterS();
                                            //tabfbdpagecontrol.ID = tblpou.pouID;
                                            tabfbdpagecontrol.drawarea.Size = new System.Drawing.Size(1454, 969);
                                            tabfbdpagecontrol.drawarea.Invalidate();

                                            MainForm.Instance().ShowTabPage(tabfbdpagecontrol);
                                            tabfbdpagecontrol.drawarea.Initialize();
                                            tabfbdpagecontrol.drawarea.Refresh();
                                            MainForm.Instance().UpdateToolbox();
                                        }
                                        else
                                        {
                                            MainForm.Instance().activateDoc(TABPAGETYPE.FBD, tblpou.pouID);
                                        }
                                        break;

                                    case PROGRAM_LANGUAGE.ENUM_PROGRAM_LANGUAGE_SFC:
                                        if (!MainForm.Instance().CheckDocIsOpen(TABPAGETYPE.SFC, tblpou.pouID))
                                        {
                                            TabSFCPageControl tabsfcpagecontrol = new TabSFCPageControl(tblpou.pouID);
                                            tabsfcpagecontrol.TitleText = node.Text;
                                            tabsfcpagecontrol.LoadTabPage();
                                            tabsfcpagecontrol.UpdateToolstripNavigation();
                                            MainForm.Instance().m_propertyGrid.SelectedObject = tabsfcpagecontrol.PouObject;
                                            MainForm.Instance().m_propertyGrid.HiddenProperties = tabsfcpagecontrol.PouObject.PropertyGridFilterH();
                                            MainForm.Instance().m_propertyGrid.BrowsableProperties = tabsfcpagecontrol.PouObject.PropertyGridFilterS();
                                            //tabfbdpagecontrol.ID = tblpou.pouID;
                                            tabsfcpagecontrol.drawarea.Size = new System.Drawing.Size(1454, 969);
                                            tabsfcpagecontrol.drawarea.Invalidate();

                                            MainForm.Instance().ShowTabPage(tabsfcpagecontrol);
                                            tabsfcpagecontrol.drawarea.Initialize();
                                            tabsfcpagecontrol.drawarea.Refresh();
                                            MainForm.Instance().UpdateToolbox();
                                        }
                                        break;

                                    case PROGRAM_LANGUAGE.ENUM_PROGRAM_LANGUAGE_ST:
                                        if (!MainForm.Instance().CheckDocIsOpen(TABPAGETYPE.ST, tblpou.pouID))
                                        {
                                            TabSTPageControl tabstpagecontrol = new TabSTPageControl(tblpou.pouID);
                                            MainForm.Instance().m_propertyGrid.SelectedObject = tabstpagecontrol.PouObject;
                                            MainForm.Instance().m_propertyGrid.HiddenProperties = tabstpagecontrol.PouObject.PropertyGridFilterH();
                                            MainForm.Instance().m_propertyGrid.BrowsableProperties = tabstpagecontrol.PouObject.PropertyGridFilterS();

                                            // tabstpagecontrol.ImageIndex = 0;
                                            tabstpagecontrol.TitleText = node.Text;
                                            tabstpagecontrol.LoadTabPage();
                                            MainForm.Instance().ShowTabPage(tabstpagecontrol);
                                        }
                                        else
                                        {
                                            MainForm.Instance().activateDoc(TABPAGETYPE.ST, tblpou.pouID);
                                        }
                                        break;
                                    }


                                    return;
                                    //break;
                                }
                            }
                        }
                    }
                    break;

                    #endregion
                case TREE_NODE_TYPE.FUNCTION:
                    #region FUNCTION

                    node = (EWSTreeNode)treeViewControl.SelectedNode;
                    //foreach (tblFunction tblfunction in tblSolution.m_tblSolution().m_tblFunctionCollection)
                    foreach (tblPou tblpou in tblSolution.m_tblSolution().Dummytblcontroller.m_tblPouCollection)
                    {
                        //if (tblfunction.FunctionName.ToUpper() == node.Text.ToUpper())
                        if (tblpou.pouID == node.NodeID)
                        {
                            switch ((PROGRAM_LANGUAGE)tblpou.Language)
                            {
                            case PROGRAM_LANGUAGE.ENUM_PROGRAM_LANGUAGE_FBD:

                                if (!MainForm.Instance().CheckDocIsOpen(TABPAGETYPE.FBD, tblpou.pouID))
                                {
                                    TabFBDPageControl tabudfbdpagecontrol = new TabFBDPageControl(tblpou.pouID);
                                    tabudfbdpagecontrol.TitleText = node.Text;
                                    tabudfbdpagecontrol.LoadTabPage();
                                    tabudfbdpagecontrol.UpdateToolstripNavigation();
                                    MainForm.Instance().m_propertyGrid.SelectedObject = tabudfbdpagecontrol.PouObject;
                                    MainForm.Instance().m_propertyGrid.HiddenProperties = tabudfbdpagecontrol.PouObject.PropertyGridFilterH();
                                    MainForm.Instance().m_propertyGrid.BrowsableProperties = tabudfbdpagecontrol.PouObject.PropertyGridFilterS();
                                    //tabudfbdpagecontrol.ID = tblpou.pouID;
                                    tabudfbdpagecontrol.drawarea.Size = new System.Drawing.Size(1454, 969);
                                    tabudfbdpagecontrol.drawarea.Invalidate();

                                    MainForm.Instance().ShowTabPage(tabudfbdpagecontrol);
                                    tabudfbdpagecontrol.drawarea.Initialize();
                                    tabudfbdpagecontrol.drawarea.Refresh();
                                    MainForm.Instance().UpdateToolbox();
                                }
                                else
                                {
                                    MainForm.Instance().activateDoc(TABPAGETYPE.FBD, tblpou.pouID);
                                }
                                break;

                            case PROGRAM_LANGUAGE.ENUM_PROGRAM_LANGUAGE_ST:
                                if (!MainForm.Instance().CheckDocIsOpen(TABPAGETYPE.ST, tblpou.pouID))
                                {
                                    TabSTPageControl tabstpagecontrol = new TabSTPageControl(tblpou.pouID);
                                    MainForm.Instance().m_propertyGrid.SelectedObject = tabstpagecontrol.PouObject;
                                    MainForm.Instance().m_propertyGrid.HiddenProperties = tabstpagecontrol.PouObject.PropertyGridFilterH();
                                    MainForm.Instance().m_propertyGrid.BrowsableProperties = tabstpagecontrol.PouObject.PropertyGridFilterS();

                                    // tabstpagecontrol.ImageIndex = 0;
                                    tabstpagecontrol.TitleText = node.Text;
                                    tabstpagecontrol.LoadTabPage();
                                    MainForm.Instance().ShowTabPage(tabstpagecontrol);
                                }
                                else
                                {
                                    MainForm.Instance().activateDoc(TABPAGETYPE.ST, tblpou.pouID);
                                }
                                break;
                            }


                            return;
                            //break;
                        }
                    }
                    break;

                    #endregion
                case TREE_NODE_TYPE.FUNCTIONBLOCK:

                    break;
                }
            }
        }