示例#1
0
        private void cmdCloseProject_Click(object sender, EventArgs e)
        {
            if (treeStep7Project.SelectedNode != null)
            {
                myTreeNode nd = (myTreeNode)treeStep7Project.SelectedNode;
                while (nd.Parent != null)
                {
                    nd = (myTreeNode)nd.Parent;
                }
                treeStep7Project.Nodes.Remove(nd);
            }

            List <string> projects = new List <string>();

            foreach (myTreeNode myTreeNode in treeStep7Project.Nodes)
            {
                projects.Add(((ProjectFolder)myTreeNode.myObject).Project.ProjectFile);
            }

            var col = new StringCollection();

            col.AddRange(projects.ToArray());
            Settings.Default.OpenedProjects = col;
            Settings.Default.Save();
        }
 public Diagnostic(AppManager apm, BACnetManager bnm, myTreeNode deviceTreeNode)
 {
     this.devicTreeNode = deviceTreeNode;
     this.device        = deviceTreeNode.device;
     _apm = apm;
     _bnm = bnm;
 }
示例#3
0
 /// <summary>
 /// Ricorsione del metodo "pulisceNodiOrfaniRF"
 /// </summary>
 /// <param name="nodo"></param>
 private void ricorsioneCercaFigliOrfaniRF(myTreeNode nodo)
 {
     if (nodo.getTipoNodo().Equals("U"))
     {
         if (nodo.Nodes.Count > 0)
         {
             try
             {
                 foreach (myTreeNode currentNode in nodo.Nodes)
                 {
                     if (currentNode.Nodes.Count == 0 && currentNode.getTipoNodo().Equals("U"))
                     {
                         currentNode.Remove();
                     }
                     else
                     {
                         this.ricorsioneCercaFigliOrfaniRF(currentNode);
                     }
                 }
             }
             catch
             {
                 this.pulisceNodiOrfaniRF();
                 return;
             }
         }
     }
 }
        public void AddNodes(TreeNode nd, List<ProjectFolder> lst)
        {
            foreach (var subitem in lst)
            {
                myTreeNode tmpNode = new myTreeNode();
                tmpNode.Text = subitem.Name;
                tmpNode.myObject = subitem;
                tmpNode.ImageIndex = 0;
                //nd.ImageKey
                //Set the Image for the Folders...
                if (subitem.GetType() == typeof (StationConfigurationFolder))
                {
                    if (((StationConfigurationFolder) subitem).StationType == PLCType.Simatic300)
                        tmpNode.ImageIndex = 4;
                    else if (((StationConfigurationFolder) subitem).StationType == PLCType.Simatic400 ||
                             ((StationConfigurationFolder) subitem).StationType == PLCType.Simatic400H)
                        tmpNode.ImageIndex = 5;
                }
                else if (subitem.GetType() == typeof (CPUFolder))
                {
                    if (((CPUFolder) subitem).CpuType == PLCType.Simatic300) tmpNode.ImageIndex = 2;
                    else if (((CPUFolder) subitem).CpuType == PLCType.Simatic400 ||
                             ((CPUFolder) subitem).CpuType == PLCType.Simatic400H) tmpNode.ImageIndex = 3;
                }

                nd.Nodes.Add(tmpNode);

                if (subitem.SubItems != null) AddNodes(tmpNode, subitem.SubItems);
            }
        }
示例#5
0
        /// <summary>
        /// Visualizza partendo dalla UO selezionata in Treeview
        /// </summary>
        private void VisualizzaUOSelezionata()
        {
            try
            {
                if (this.treeViewUO.SelectedNodeIndex != string.Empty || this.treeViewUO.SelectedNodeIndex != "")
                {
                    myTreeNode TreeNodo;
                    TreeNodo = (myTreeNode)treeViewUO.GetNodeFromIndex(treeViewUO.SelectedNodeIndex);

                    if (TreeNodo.getTipoNodo().Equals("U"))                    // solo se è una UO
                    {
                        DocsPaWR.OrgUO currentUO = this.GetDatiUOCorrente(TreeNodo.ID);
                        if (currentUO != null)
                        {
                            // diventa la ROOT della treeview
                            myTreeNode treenode = new myTreeNode();
                            treenode = this.SetRootTreeview(currentUO);

                            this.SetRootTreeviewExpanded();

                            this.ImpostaValoreDiRicercaNascosto(currentUO.IDCorrGlobale + "_" + currentUO.IDParent + "_U");
                        }
                    }
                }
            }
            catch
            {
                this.executeJS("<SCRIPT>alert('Attenzione, si è verificato un errore di sistema');</SCRIPT>");
            }
        }
示例#6
0
        /// <summary>
        /// Converte i dati visualizzati nella Treeview in un file XML
        /// </summary>
        /// <returns></returns>
        private XmlDocument exportToXML()
        {
            XmlDocument xmldoc = new XmlDocument();

            if (this.treeViewUO.Nodes.Count > 0)
            {
                myTreeNode nodo = (myTreeNode)treeViewUO.GetNodeFromIndex("0");

                //gestione RF
                string titoloPDF = string.Empty;
                if (this.verificaStatoRicercaRF())
                {
                    titoloPDF = "Composizione RF: " + this.ddl_RF.Items[this.ddl_RF.SelectedIndex].Text;
                }
                else
                {
                    titoloPDF = "Organigramma";
                }

                XmlNode organigramma = xmldoc.AppendChild(xmldoc.CreateElement("ORGANIGRAMMA"));

                XmlAttribute attrRoot = xmldoc.CreateAttribute("title");
                attrRoot.InnerText = titoloPDF;
                organigramma.Attributes.Append(attrRoot);

                XmlElement record = xmldoc.CreateElement("RECORD");
                record.SetAttribute("tipo", nodo.getTipoNodo());
                record.SetAttribute("desc", nodo.Text);
                xmldoc.DocumentElement.AppendChild(record);

                this.addElement(nodo, xmldoc, 1);
            }

            return(xmldoc);
        }
 private void caricaTreeViewUtenti(DocsPaWR.RuoloSmistamento ruolo, myTreeNode nodoRuolo, bool daModello)
 {
     if (ruolo.Utenti != null && ruolo.Utenti.Length > 0)
     {
         foreach (DocsPaWR.UtenteSmistamento utente in ruolo.Utenti)
         {
             if (utente.FlagCompetenza || utente.FlagConoscenza)
             {
                 myTreeNode nodoUtente = new myTreeNode();
                 nodoUtente.Text = utente.Denominazione;
                 if (!ruolo.FlagCompetenza && !ruolo.FlagConoscenza)
                 {
                     nodoUtente.Text += (utente.FlagCompetenza) ? " - (COMPETENZA)" : " - (CONOSCENZA)";
                 }
                 nodoUtente.ID       = utente.ID;
                 nodoUtente.TIPO     = "P";
                 nodoUtente.Expanded = true;
                 nodoUtente.ImageUrl = "~/Images/Icons/user_icon.png";
                 nodoRuolo.ChildNodes.Add(nodoUtente);
             }
             else
             {
                 if (daModello)
                 {
                     myTreeNode nodoUtente = new myTreeNode();
                     nodoUtente.Text     = utente.Denominazione;
                     nodoUtente.ID       = utente.ID;
                     nodoUtente.TIPO     = "P";
                     nodoUtente.Expanded = true;
                     nodoRuolo.ChildNodes.Add(nodoUtente);
                 }
             }
         }
     }
 }
示例#8
0
        /// <summary>
        /// Ricorsione
        /// </summary>
        /// <param name="nodo"></param>
        /// <param name="xmldoc"></param>
        /// <param name="indentazionePadre"></param>
        private void addElement(myTreeNode nodo, XmlDocument xmldoc, int indentazionePadre)
        {
            string prefisso = string.Empty;

            if (nodo.Expanded && nodo.Nodes.Count > 0)
            {
                indentazionePadre += 1;

                Microsoft.Web.UI.WebControls.TreeNodeCollection nodi = nodo.Nodes;
                foreach (myTreeNode n in nodi)
                {
                    XmlElement record = xmldoc.CreateElement("RECORD");
                    record.SetAttribute("tipo", n.getTipoNodo());
                    switch (n.getTipoNodo())
                    {
                    case "U":
                        prefisso = "[UO] ";
                        break;

                    case "R":
                        prefisso = "[R] ";
                        break;

                    case "P":
                        prefisso = "[U] ";
                        break;
                    }
                    record.SetAttribute("desc", this.addIndentation(indentazionePadre) + prefisso + n.Text);
                    xmldoc.DocumentElement.AppendChild(record);

                    this.addElement(n, xmldoc, indentazionePadre);
                }
            }
        }
示例#9
0
        /// <summary>
        /// Caricamento dati UO livello ZERO
        /// </summary>
        /// <param name="listaUO"></param>
        private void LoadTreeviewLivelloZero(ArrayList listaUO)
        {
            try
            {
                string myPath = DocsPAWA.Utils.getHttpFullPath(this);

                this.PulisceTuttaTreeView();

                Microsoft.Web.UI.WebControls.TreeNode treenode = new Microsoft.Web.UI.WebControls.TreeNode();

                treenode.Text = "Organigramma";

                treeViewUO.Nodes.Add(treenode);

                Microsoft.Web.UI.WebControls.TreeNode tNode = new Microsoft.Web.UI.WebControls.TreeNode();
                tNode = treeViewUO.Nodes[0];

                myTreeNode nodoT;
                myTreeNode nodoFiglio;

                foreach (DocsPAWA.DocsPaWR.OrgUO uo in listaUO)
                {
                    nodoT = new myTreeNode();

                    nodoT.ID       = uo.IDCorrGlobale;
                    nodoT.Text     = uo.CodiceRubrica + " - " + uo.Descrizione;
                    nodoT.ImageUrl = myPath + "/AdminTool/Images/uo.gif";

                    tNode.Nodes.Add(nodoT);

                    nodoT.setTipoNodo("U");
                    nodoT.setIDCorrGlobale(uo.IDCorrGlobale);
                    nodoT.setCodice(uo.Codice);
                    nodoT.setCodiceRubrica(uo.CodiceRubrica);
                    nodoT.setDescrizione(uo.Descrizione);
                    nodoT.setLivello(uo.Livello);
                    nodoT.setIDAmministrazione(uo.IDAmministrazione);

                    if ((!uo.Ruoli.Equals("0")) || (!uo.SottoUo.Equals("0")))
                    {
                        nodoFiglio      = new myTreeNode();
                        nodoFiglio.Text = "<font color='#ff0000'>&nbsp;loading...</font>";
                        nodoT.Nodes.Add(nodoFiglio);
                    }
                    else
                    {
                        nodoT.Text = uo.CodiceRubrica + " - " + uo.Descrizione;
                    }
                }

                tNode.Expanded = true;
                //this.SelezionaPrimo();
                this.LoadTreeViewLivelloFigli("0.0", "U");
            }
            catch
            {
                this.executeJS("<SCRIPT>alert('Attenzione, si è verificato un errore di sistema');</SCRIPT>");
            }
        }
示例#10
0
        private void treeView2_AfterSelect(object sender, TreeViewEventArgs e)
        {
            myTreeNode myNode = (myTreeNode)e.Node;

            // 선택된 노드의 FilePath를 쓰기위해 캐스팅 해 줘야됨.
            // e.Node는 TreeNode로 선언되어 있지만 실제 노드 인스턴스는 myTreeNode인스턴스 타입.
            MessageBox.Show(myNode.FilePath);
        }
示例#11
0
 /// <summary>
 /// Espande tutto l'organigramma dalla Root
 /// </summary>
 private void EspandeOrgDallaRoot()
 {
     if (this.treeViewUO.Nodes.Count > 0)
     {
         myTreeNode TreeNodo = (myTreeNode)treeViewUO.GetNodeFromIndex("0");
         this.ricorsioneCercaFigli(TreeNodo);
     }
 }
示例#12
0
        /// <summary>
        /// 选择中时触发事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void treeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            myTreeNode myTree = TreeView.SelectedNode as myTreeNode;

            this.Text       = myTree.Text;
            this.NodeCode   = myTree.NodeCode;
            this.ParentNode = myTree.ParentNode;
            dropDown.Close();
        }
示例#13
0
        /// <summary>
        /// Elimina i nodi di tipo UO sulla TreeView che non presentano ruoli associati all'RF selezionato
        /// </summary>
        private void pulisceNodiOrfaniRF()
        {
            if (this.treeViewUO.Nodes.Count > 0)
            {
                myTreeNode TreeNodo = (myTreeNode)treeViewUO.GetNodeFromIndex("0");

                this.ricorsioneCercaFigliOrfaniRF(TreeNodo);
            }
        }
示例#14
0
        private void btn_ok_Click(object sender, System.EventArgs e)
        {
            if (TreeView1.SelectedNodeIndex != "0")
            {
                Page.Session.Remove("risultatoRicerca");

                myTreeNode nodoSel = (myTreeNode)this.TreeView1.GetNodeFromIndex(TreeView1.SelectedNodeIndex);
                if (nodoSel != null && nodoSel.getCODICE() != "T")
                {
                    DocsPaWR.FascicolazioneClassificazione classificazione = new DocsPAWA.DocsPaWR.FascicolazioneClassificazione();
                    classificazione.codice      = nodoSel.getCODICE();
                    classificazione.descrizione = nodoSel.getDESCRIZIONE();
                    classificazione.systemID    = nodoSel.getIDRECORD();
                    //classificazione.numMesiConservazione = nodoSel.getNUMMESICONSERVAZIONE();

                    //
                    // Mev Ospedale Maggiore Policlinico
                    if (Request.QueryString["isFasc"] == "gestRiclassFasc")
                    {
                        FascicoliManager.setClassificazioneSelezionata(this, classificazione);
                    }
                    // End Mev
                    //

                    if (Request.QueryString["isFasc"] == "gestFasc")
                    {
                        FascicoliManager.setClassificazioneSelezionata(this, classificazione);
                    }
                    if (Request.QueryString["isFasc"] == "gestArchivio" || Request.QueryString["isFasc"] == "gestScarto")
                    {
                        Session.Add("DaTit", "T");
                        DocsPaWR.Fascicolo fascicoloSelezionato = FascicoliManager.getFascicoloDaCodice(this, classificazione.codice);
                        if (fascicoloSelezionato != null)
                        {
                            FascicoliManager.setFascicoloSelezionato(this, fascicoloSelezionato);
                        }
                    }
                    //if (Request.QueryString["isFasc"] == "gestScarto")
                    //{
                    //    FascicoliManager.setClassificazioneSelezionata(this, classificazione);
                    //}
                    if (Request.QueryString["isFasc"] == "gestClass" || Request.QueryString["isFasc"] == "gestDoc" || Request.QueryString["isFasc"] == "gestProt" || Request.QueryString["isFasc"] == "gestTodolist" || Request.QueryString["isFasc"] == "gestProtInSempl")
                    {
                        DocumentManager.setClassificazioneSelezionata(this, classificazione);
                    }

                    if (!this.IsStartupScriptRegistered("chiudiModalDialog2"))
                    {
                        string scriptString = "<SCRIPT>window.close()</SCRIPT>";
                        this.RegisterStartupScript("chiudiModalDialog2", scriptString);
                    }
                }
            }
        }
示例#15
0
        private void BACnetInternetworkTreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                // select the node, just to highlight the last item right clicked on
                TreeViewDevices.SelectedNode = e.Node;

                // Only works if the TreeNode is of type myTreeNode sub-class of TreeNode.

                if (e.Node is myTreeNode)
                {
                    myTreeNode mtn = (myTreeNode)e.Node;

                    switch (mtn.type)
                    {
                    case myTreeNode.TREENODE_OBJ_TYPE.Device:
                        // store the IP address, dest network, etc for the next action - todo, there must be a better way to do this; create a new class??

                        switch (mtn.device.type)
                        {
                        case BACnetEnums.DEVICE_TYPE.Router:
                            menuDevice = mtn.device;
                            contextMenuStripForRouter.Show(TreeViewDevices, e.Location);
                            break;

                        default:
                            menuDevice = mtn.device;
                            mycontextMenuStrip.Show(TreeViewDevices, e.Location);
                            break;
                        }
                        break;

                    case myTreeNode.TREENODE_OBJ_TYPE.BACnetObject:
                        BACnetOID = mtn.oID;
                        contextMenuStripForObject.Show(TreeViewDevices, e.Location);
                        break;

                    case myTreeNode.TREENODE_OBJ_TYPE.NetworkNumber:
                        break;

                    case myTreeNode.TREENODE_OBJ_TYPE.DiagnosticDetails:

                        savedMTN        = mtn;
                        savedDiagnostic = mtn.diagnostic;
                        contextMenuStripForDiagnostic.Show((Control)sender, e.Location);
                        break;

                    default:
                        _bnm.MessageTodo("m0192 - Unimplemented Menu");
                        break;
                    }
                }
            }
        }
示例#16
0
        /// <summary>
        /// Ricorsione sui nodi figli della treeview
        /// </summary>
        /// <param name="nodo"></param>
        private void ricorsioneCercaFigli(myTreeNode nodo)
        {
            if (nodo.getTipoNodo().Equals("U"))
            {
                this.executeExpand(nodo.GetNodeIndex());

                foreach (myTreeNode currentNode in nodo.Nodes)
                {
                    this.ricorsioneCercaFigli(currentNode);
                }
            }
        }
        private void caricaTreeViewUO(DocsPaWR.UOSmistamento uo, bool primaUo)
        {
            myTreeNode treenode = new myTreeNode();

            if (primaUo)
            {
                myTreeNode treenodeIntestazione = new myTreeNode();
                treenodeIntestazione.Text     = "Selezioni Utente";
                treenodeIntestazione.TIPO     = "IS";
                treenodeIntestazione.Expanded = true;
                treenodeIntestazione.Selected = true;
                this.TreeSmistaDocSelection.Nodes.Add(treenodeIntestazione);
            }
            treenode = (myTreeNode)TreeSmistaDocSelection.Nodes[0];
            myTreeNode treenodeUo = new myTreeNode();

            treenodeUo.Text = uo.Descrizione;
            if (uo.FlagCompetenza || uo.FlagConoscenza)
            {
                treenodeUo.Text += (uo.FlagCompetenza) ? " - (COMPETENZA)" : " - (CONOSCENZA)";
            }
            treenodeUo.ID       = uo.ID;
            treenodeUo.TIPO     = "U";
            treenodeUo.Expanded = true;
            treenodeUo.ImageUrl = "~/Images/Icons/uo_icon.png";
            treenode.ChildNodes.Add(treenodeUo);

            if (uo.Ruoli != null && uo.Ruoli.Length > 0)
            {
                foreach (DocsPaWR.RuoloSmistamento ruolo in uo.Ruoli)
                {
                    if (ruolo.FlagCompetenza || ruolo.FlagConoscenza || this.isOneUtenteChecked(ruolo))
                    {
                        myTreeNode nodoRuolo = new myTreeNode();
                        nodoRuolo.Text = ruolo.Descrizione;
                        if ((ruolo.FlagCompetenza || ruolo.FlagConoscenza) && !uo.FlagCompetenza && !uo.FlagConoscenza)
                        {
                            nodoRuolo.Text += (ruolo.FlagCompetenza) ? " - (COMPETENZA)" : " - (CONOSCENZA)";
                        }
                        nodoRuolo.ID       = ruolo.ID;
                        nodoRuolo.TIPO     = "R";
                        nodoRuolo.Expanded = true;
                        nodoRuolo.ImageUrl = "~/Images/Icons/role2_icon.png";
                        treenodeUo.ChildNodes.Add(nodoRuolo);
                        this.caricaTreeViewUtenti(ruolo, nodoRuolo, false);
                    }
                }
            }
        }
示例#18
0
        /// <summary>
        /// Salto alla pagina web chiamante dopo aver selezionato una ricerca
        /// </summary>
        /// <param name="TreeNodo"></param>
        private void TornaAllaWndChiamante(myTreeNode TreeNodo)
        {
            bool   gotoParent = false;
            string idGeneric  = string.Empty;            // potrebbe essere idGroup (x i ruoli) o idPeople (x gli utenti) o uguale a idCorrGlob (x le UO)

            try
            {
                switch (TreeNodo.getTipoNodo())
                {
                case "U":
                    if (this.SelezionePossibile("U"))
                    {
                        gotoParent = true;
                        idGeneric  = TreeNodo.getIDCorrGlobale();
                    }
                    break;

                case "R":
                    if (this.SelezionePossibile("R"))
                    {
                        gotoParent = true;
                        idGeneric  = TreeNodo.getIDGruppo();
                    }
                    break;

                case "P":
                    if (this.SelezionePossibile("P"))
                    {
                        gotoParent = true;
                        idGeneric  = TreeNodo.getIDPeople();
                    }
                    break;
                }

                if (gotoParent)
                {
                    string codice      = TreeNodo.getCodice();
                    string descrizione = TreeNodo.getDescrizione();
                    string idCorrGlob  = TreeNodo.getIDCorrGlobale();

                    string retValue = codice + "|" + descrizione + "|" + idCorrGlob + "|" + idGeneric;
                    this.executeJS("<SCRIPT>window.returnValue='" + retValue + "'; window.close()</SCRIPT>");
                }
            }
            catch
            {
                this.executeJS("<SCRIPT>alert('Attenzione, si è verificato un errore di sistema');</SCRIPT>");
            }
        }
        private void AddNodes(TreeNode nd, List<ProjectFolder> lst)
        {
            foreach (var subitem in lst)
            {
                myTreeNode tmpNode = new myTreeNode();
                tmpNode.Text = subitem.Name;
                tmpNode.myObject = subitem;
                tmpNode.ImageIndex = 0;
                //nd.ImageKey
                //Set the Image for the Folders...
                if (subitem.GetType() == typeof(StationConfigurationFolder))
                {
                    if (((StationConfigurationFolder)subitem).StationType==PLCType.Simatic300)
                        tmpNode.ImageIndex = 4;
                    else if (((StationConfigurationFolder)subitem).StationType == PLCType.Simatic400 || ((StationConfigurationFolder)subitem).StationType == PLCType.Simatic400H)
                        tmpNode.ImageIndex = 5;
                }
                else if (subitem.GetType() == typeof(CPUFolder))
                {
                    if (((CPUFolder)subitem).CpuType == PLCType.Simatic300)
                        tmpNode.ImageIndex = 2;
                    else if (((CPUFolder)subitem).CpuType == PLCType.Simatic400 || ((CPUFolder)subitem).CpuType == PLCType.Simatic400H)
                        tmpNode.ImageIndex = 3;
                }

                nd.Nodes.Add(tmpNode);

                if (subitem.SubItems != null)
                    AddNodes(tmpNode, subitem.SubItems);

                if (subitem is BlocksOfflineFolder  && this.SelectPart==SelectPartType.Tag)
                {
                    BlocksOfflineFolder blkFld = (BlocksOfflineFolder) subitem;
                    foreach (ProjectPlcBlockInfo projectBlockInfo in blkFld.readPlcBlocksList())
                    {
                        if (projectBlockInfo.BlockType == PLCBlockType.DB || projectBlockInfo.BlockType == PLCBlockType.S5_DB || projectBlockInfo.BlockType == PLCBlockType.S5_DX)
                        {
                            string nm = projectBlockInfo.BlockName;
                            if (projectBlockInfo.SymbolTabelEntry != null)
                                nm += " (" + projectBlockInfo.SymbolTabelEntry.Symbol + ")";
                            DBTreeNode trnd = new DBTreeNode() {Text = nm, PLCBlockInfo = projectBlockInfo};
                            trnd.Nodes.Add(new FakeNode());
                            tmpNode.Nodes.Add(trnd);
                        }
                    }

                }
            }
        }
示例#20
0
        /// <summary>
        /// Visualizza nella Treeview il dato ricercato
        /// </summary>
        /// <param name="returnValue"></param>
        private void VisualizzaNodoRicercato(string returnValue)
        {
            try
            {
                myTreeNode treenode;

                this.hd_returnValueModal.Value     = "";
                this.hd_lastReturnValueModal.Value = returnValue;

                /*
                 *      possibili valori di ritorno:
                 *
                 *              idCorrGlobUO_idParentUO_U					=	ricerca traUO
                 *              idCorrGlobRuolo_idCorrGlobUO_R				=	ricerca tra ruoli
                 *              idCorrGlobPersona_idCorrGlobRuolo_<PN>/<PC>	=	ricerca tra utenti
                 */

                string[] appo          = returnValue.Split('_');
                string   idCorrGlobale = appo[0];
                string   idParent      = appo[1];
                string   tipo          = appo[2];

                switch (tipo)
                {
                case "R":
                    idCorrGlobale = idParent;
                    break;

                case "PN":
                case "PC":
                    idCorrGlobale = this.GetUOPadre(idParent, tipo);
                    break;
                }

                DocsPaWR.OrgUO currentUO = this.GetDatiUOCorrente(idCorrGlobale);
                if (currentUO != null)
                {
                    // diventa la ROOT della treeview
                    treenode = new myTreeNode();
                    treenode = this.SetRootTreeview(currentUO);

                    this.SetRootTreeviewExpanded();
                }
            }
            catch
            {
                this.executeJS("<SCRIPT>alert('Attenzione, si è verificato un errore di sistema');</SCRIPT>");
            }
        }
示例#21
0
        void AddNewMyTreeNodeWithTextColor(myTreeNode mtn, myTreeNode relatedDeviceNode, String text, System.Drawing.Color col)
        {
            mtn.BackColor = col;
            mtn.Nodes.Add(text);

            // expand any failed diagnostics
            if (col == System.Drawing.Color.HotPink)
            {
                // todo, clean this up, bad form to depend on color to indicate failure
                mtn.Expand();
            }

            // todo, create heirarchy of colors
            relatedDeviceNode.BackColor = col;
        }
示例#22
0
 public void SetupDiagnosticsNew()
 {
     lock (_apm)
     {
         foreach (TreeNode networkNode in TreeViewDevices.Nodes)
         {
             foreach (myTreeNode deviceNode in networkNode.Nodes)
             {
                 myTreeNode mtn = deviceNode.EnsureMyTreeNodeObject(myTreeNode.TREENODE_OBJ_TYPE.ScheduledDiagnostics, "Scheduled Diagnostics");
                 // Add our new test
                 AddDiagnosticsTomyTreeNodeDiagnosticListAll(_apm, _bnm, deviceNode, mtn);
             }
         }
     }
 }
示例#23
0
        private void caricaTreeViewUO(DocsPaWR.UOSmistamento uo, bool primaUo)
        {
            myTreeNode treenode = new myTreeNode();

            if (primaUo)
            {
                myTreeNode treenodeIntestazione = new myTreeNode();
                treenodeIntestazione.Text = "Selezioni Utente";
                treenodeIntestazione.DefaultStyle["font-weight"] = "bold";
                treenodeIntestazione.setTipoNodo("IS");
                treenodeIntestazione.Expanded = true; // Espande il nodo
                this.treeViewSelezioni.Nodes.Add(treenodeIntestazione);
            }
            treenode = (myTreeNode)treeViewSelezioni.Nodes[0];
            myTreeNode treenodeUo = new myTreeNode();

            treenodeUo.Text = uo.Descrizione;
            if (uo.FlagCompetenza || uo.FlagConoscenza)
            {
                treenodeUo.Text += (uo.FlagCompetenza) ? " - (COMPETENZA)" : " - (CONOSCENZA)";
            }
            treenodeUo.ID = uo.ID;
            treenodeUo.setTipoNodo("U");
            treenodeUo.Expanded = true;
            treenodeUo.DefaultStyle["font-weight"] = "bold";
            treenode.Nodes.Add(treenodeUo);
            if (uo.Ruoli != null && uo.Ruoli.Length > 0)
            {
                foreach (DocsPAWA.DocsPaWR.RuoloSmistamento ruolo in uo.Ruoli)
                {
                    if (ruolo.FlagCompetenza || ruolo.FlagConoscenza || this.isOneUtenteChecked(ruolo))
                    {
                        myTreeNode nodoRuolo = new myTreeNode();
                        nodoRuolo.Text = ruolo.Descrizione;
                        if ((ruolo.FlagCompetenza || ruolo.FlagConoscenza) && !uo.FlagCompetenza && !uo.FlagConoscenza)
                        {
                            nodoRuolo.Text += (ruolo.FlagCompetenza) ? " - (COMPETENZA)" : " - (CONOSCENZA)";
                        }
                        nodoRuolo.ID = ruolo.ID;
                        nodoRuolo.setTipoNodo("R");
                        nodoRuolo.Expanded = true;
                        treenodeUo.Nodes.Add(nodoRuolo);
                        this.caricaTreeViewUtenti(ruolo, nodoRuolo, false);
                    }
                }
            }
        }
示例#24
0
        public static void AddUniqueDiagnostics(myTreeNode mtnDiagnosticList, List <Diagnostic> diagList)
        {
            // remove existing diags from the above list if they already exist in the treeview
            foreach (myTreeNode mtn in mtnDiagnosticList.Nodes)
            {
                // remove matching diagnostic in diagList
                diagList.RemoveAll(d => d.GetType() == mtn.diagnostic.GetType());
            }

            // add remaining diags to the diag list in the treenode
            foreach (Diagnostic d in diagList)
            {
                myTreeNode mtnd = mtnDiagnosticList.AddMyTreeNodeObject(myTreeNode.TREENODE_OBJ_TYPE.DiagnosticDetails, d.ToString());
                mtnd.diagnostic   = d;
                d.displayTreeNode = mtnd;
            }
        }
示例#25
0
        /// <summary>
        /// Imposta la Root nella Treeview
        /// </summary>
        /// <param name="currentUO"></param>
        /// <returns></returns>
        private myTreeNode SetRootTreeview(DocsPAWA.DocsPaWR.OrgUO currentUO)
        {
            this.PulisceTuttaTreeView();

            myTreeNode treenode = new myTreeNode();

            treenode.ID   = currentUO.IDCorrGlobale;
            treenode.Text = currentUO.Codice + " - " + currentUO.Descrizione;

            treeViewUO.Nodes.Add(treenode);

            treenode.setTipoNodo("U");
            treenode.setRuoliUO(currentUO.Ruoli);
            treenode.setSottoUO(currentUO.SottoUo);
            treenode.setLivello(currentUO.Livello);

            return(treenode);
        }
        void loadPrj()
        {
            if (fnm != "")
            {
                treeStep7Project.Nodes.Clear();

                tmpPrj = Projects.LoadProject(fnm.Split('|')[0], chkShowDeleted.Checked);

                lblProjectName.Text = tmpPrj.ProjectName;
                lblProjectInfo.Text = tmpPrj.ProjectDescription;

                myTreeNode trnd = new myTreeNode();
                trnd.myObject   = tmpPrj.ProjectStructure;
                trnd.Text       = tmpPrj.ProjectStructure.Name;
                trnd.ImageIndex = 0;
                AddNodes(trnd, tmpPrj.ProjectStructure.SubItems);
                treeStep7Project.Nodes.Add(trnd);
            }
        }
示例#27
0
        /// <summary>
        /// Visualizza gli utenti di un ruolo
        /// </summary>
        /// <param name="nodoRuoli"></param>
        /// <param name="ruolo"></param>
        private void UtentiRuolo(myTreeNode nodoRuoli, DocsPAWA.DocsPaWR.OrgRuolo ruolo)
        {
            myTreeNode nodoUtenti;

            nodoRuoli.Expanded = true;

            foreach (DocsPAWA.DocsPaWR.OrgUtente utente in ruolo.Utenti)
            {
                nodoUtenti = new myTreeNode();

                nodoUtenti.ID       = utente.IDCorrGlobale;
                nodoUtenti.Text     = utente.CodiceRubrica + " - " + utente.Cognome + " " + utente.Nome;
                nodoUtenti.ImageUrl = HttpFullPath + "/AdminTool/Images/utente.gif";

                nodoRuoli.Nodes.Add(nodoUtenti);

                nodoUtenti.setTipoNodo("P");
            }
        }
        void loadPrj()
        {
            if (fnm != "")
            {
                treeStep7Project.Nodes.Clear();

                tmpPrj = new Step7ProjectV5(fnm, chkShowDeleted.Checked);

                //listBox1.Items.AddRange(tmp.PrgProjectFolders.ToArray());
                lblProjectName.Text = tmpPrj.ProjectName;
                lblProjectInfo.Text = tmpPrj.ProjectDescription;

                myTreeNode trnd = new myTreeNode();
                trnd.myObject   = tmpPrj.ProjectStructure;
                trnd.Text       = tmpPrj.ProjectStructure.Name;
                trnd.ImageIndex = 0;
                AddNodes(trnd, tmpPrj.ProjectStructure.SubItems);
                treeStep7Project.Nodes.Add(trnd);
            }
        }
示例#29
0
        public void AddNodes(TreeNode nd, List <ProjectFolder> lst)
        {
            foreach (var subitem in lst)
            {
                myTreeNode tmpNode = new myTreeNode();
                tmpNode.Text       = subitem.Name;
                tmpNode.myObject   = subitem;
                tmpNode.ImageIndex = 0;
                //nd.ImageKey
                //Set the Image for the Folders...
                if (subitem.GetType() == typeof(StationConfigurationFolder))
                {
                    if (((StationConfigurationFolder)subitem).StationType == PLCType.Simatic300)
                    {
                        tmpNode.ImageIndex = 4;
                    }
                    else if (((StationConfigurationFolder)subitem).StationType == PLCType.Simatic400 || ((StationConfigurationFolder)subitem).StationType == PLCType.Simatic400H)
                    {
                        tmpNode.ImageIndex = 5;
                    }
                }
                else if (subitem.GetType() == typeof(CPUFolder))
                {
                    if (((CPUFolder)subitem).CpuType == PLCType.Simatic300)
                    {
                        tmpNode.ImageIndex = 2;
                    }
                    else if (((CPUFolder)subitem).CpuType == PLCType.Simatic400 || ((CPUFolder)subitem).CpuType == PLCType.Simatic400H)
                    {
                        tmpNode.ImageIndex = 3;
                    }
                }

                nd.Nodes.Add(tmpNode);

                if (subitem.SubItems != null)
                {
                    AddNodes(tmpNode, subitem.SubItems);
                }
            }
        }
示例#30
0
        private void TornaAllaUOPadre()
        {
            if (this.treeViewUO.Nodes.Count > 0)
            {
                myTreeNode     nodoRoot  = (myTreeNode)this.treeViewUO.GetNodeFromIndex("0");
                DocsPaWR.OrgUO currentUO = this.GetDatiUOCorrente(nodoRoot.ID);
                if (currentUO != null && !currentUO.IDParent.Equals("0"))
                {
                    DocsPaWR.OrgUO UOpadre = this.GetDatiUOCorrente(currentUO.IDParent);
                    if (UOpadre != null)
                    {
                        // diventa la ROOT della treeview
                        myTreeNode treenode = new myTreeNode();
                        treenode = this.SetRootTreeview(UOpadre);

                        this.SetRootTreeviewExpanded();

                        this.ImpostaValoreDiRicercaNascosto(UOpadre.IDCorrGlobale + "_" + UOpadre.IDParent + "_U");
                    }
                }
            }
        }
示例#31
0
 /// <summary>
 /// ricerca un nodo nel titolario
 /// </summary>
 /// <param name="idrecord"></param>
 /// <param name="nodecollection"></param>
 /// <returns></returns>
 private static myTreeNode findNode(string idrecord, TreeNodeCollection nodecollection)
 {
     try
     {
         myTreeNode mytreenode = null;
         foreach (TreeNode t in nodecollection)
         {
             if (((myTreeNode)t).IDRECORD.Equals(idrecord))
             {
                 mytreenode          = (myTreeNode)t;
                 mytreenode.Selected = true;
                 break;
             }
         }
         return(mytreenode);
     }
     catch (System.Exception ex)
     {
         UIManager.AdministrationManager.DiagnosticError(ex);
         return(null);
     }
 }
示例#32
0
 /// <summary>
 /// seleziona un nodo
 /// </summary>
 /// <param name="codice"></param>
 /// <param name="nodecollection"></param>
 /// <returns></returns>
 private static myTreeNode selectNode(string codice, TreeNodeCollection nodecollection)
 {
     try
     {
         myTreeNode mytreenode = new myTreeNode();
         foreach (TreeNode t in nodecollection)
         {
             if (((myTreeNode)t).CODICE.Equals(codice))
             {
                 mytreenode          = (myTreeNode)t;
                 mytreenode.Selected = true;
                 break;
             }
         }
         return(mytreenode);
     }
     catch (System.Exception ex)
     {
         UIManager.AdministrationManager.DiagnosticError(ex);
         return(null);
     }
 }
示例#33
0
    private myTreeNode GetTreeNodeByData(string PartNo)
    {
        myTreeNode root = new myTreeNode();
        ExtendDictionary<String, myTreeNode> treeNodeInfo = new ExtendDictionary<string, myTreeNode>();
        DataTable result = iModelBOM.GetTreeTable(PartNo);

        for (int i = 0; i < result.Rows.Count; i++)
        {

            string id = Null2String(result.Rows[i][0]);
            string parent = Null2String(result.Rows[i][1]);
            string current = Null2String(result.Rows[i][2]);
            string desc = Null2String(result.Rows[i][7] + ", " + result.Rows[i][8] + ", " + result.Rows[i][3]); //BomNodeType, PartType, Descr


            myTreeNode currentNode = (myTreeNode)treeNodeInfo.Get(current);
            myTreeNode parentNode = (myTreeNode)treeNodeInfo.Get(parent);

            //处理子节点
            if (currentNode == null)
            {
                currentNode = new myTreeNode();
                currentNode.Desc = desc;
                currentNode.Id = id;
                currentNode.Current = current;
                currentNode.Value = GetTreeIdIndex();
                currentNode.Text = GetNodeText(currentNode.Current, currentNode.Desc, currentNode.Value);
                currentNode.NavigateUrl = GetURLString(currentNode.Value);
                treeNodeInfo.Add(currentNode.Current, currentNode);

            }
            else
            {
                //没有当过子节点
                if (currentNode.Id == null || currentNode.Id == "")
                {
                    currentNode.Desc = desc;
                    currentNode.Id = id;
                    currentNode.Current = current;
                    currentNode.Text = GetNodeText(currentNode.Current, currentNode.Desc, currentNode.Value);
                }
                else
                {

                    currentNode = CloneTreeNode(currentNode);
                    //新拷贝的节点拥有不同的value和id
                    currentNode.Id = id;
                }

            }

            //处理父节点
            if (parentNode == null)
            {
                parentNode = new myTreeNode();
                parentNode.Current = parent;
                parentNode.Value = GetTreeIdIndex();
                parentNode.NavigateUrl = GetURLString(parentNode.Value);
                treeNodeInfo.Add(parentNode.Current, parentNode);
            }

            parentNode.ChildNodes.Add(currentNode);
        }

        //根节点加入树
        if (treeNodeInfo.ContainsKey(PartNo))
        {
            root = (myTreeNode)treeNodeInfo.Get(PartNo);
        }
        root.Current = PartNo;
        root.Id = "";   
        root.Material = "";         //
        root.Value = GetTreeIdIndex();
        root.NavigateUrl = GetURLString(root.Value);
        root.Text = GetNodeText(root.Current, root.Desc, root.Value);
        return root;
    }
        void loadPrj()
        {
            if (fnm != "")
            {
                treeStep7Project.Nodes.Clear();

                tmpPrj = Projects.LoadProject(fnm, chkShowDeleted.Checked);
                //tmpPrj = new Step7ProjectV5(fnm, chkShowDeleted.Checked);

                //listBox1.Items.AddRange(tmp.PrgProjectFolders.ToArray());
                lblProjectName.Text = tmpPrj.ProjectName;
                lblProjectInfo.Text = tmpPrj.ProjectDescription;

                myTreeNode trnd = new myTreeNode();
                trnd.myObject = tmpPrj.ProjectStructure;
                trnd.Text = tmpPrj.ProjectStructure.Name;
                trnd.ImageIndex = 0;
                AddNodes(trnd, tmpPrj.ProjectStructure.SubItems);
                treeStep7Project.Nodes.Add(trnd);
            }
        }
示例#35
0
    // 将当前节点装入子节点的信息
    //targetNode, 当前节点
    //srcNode,被拷贝的节点
    //返回 当前节点
    private myTreeNode CloneTreeNode(myTreeNode targetNode, myTreeNode srcNode)
    {
        targetNode.ChildNodes.Clear();

        //判断找到子节点就返回
        string rootValue = srcNode.Value;
        //返回结果
        srcNode.IsCountStack = false;

        rtInfo getInfo = DealNodeInfo(srcNode, targetNode, rootValue);
        myTreeNode tmpSrcNode = getInfo.srcNode;
        myTreeNode tmpTargetNode = getInfo.targetNode;

        while (tmpSrcNode != null)
        {
            getInfo = DealNodeInfo(tmpSrcNode, tmpTargetNode, rootValue);
            tmpSrcNode = getInfo.srcNode;
            tmpTargetNode = getInfo.targetNode;
        }

        return targetNode;
    }
示例#36
0
 //深度克隆节点
 private myTreeNode CloneTreeNode(myTreeNode node)
 {
     //返回结果
     myTreeNode resultNode = copyOneNode(node);
     return CloneTreeNode(resultNode, node);
 }
        private void loadPrj(string fnm)
        {
            if (fnm != "")
            {
                /*
                dtaSymbolTable.Visible = false;
                lstListBox.Visible = false;
                txtTextBox.Visible = false;
                cmdSetKnowHow.Visible = false;
                cmdRemoveKnowHow.Visible = false;
                cmdUndeleteBlock.Visible = false;
                txtUndeleteName.Visible = false;
                */
                //treeStep7Project.Nodes.Clear();
                Project tmp = Projects.LoadProject(fnm, chkShowDeleted.Checked);
                //tmp = new Step7ProjectV5(fnm, chkShowDeleted.Checked);

                //listBox1.Items.AddRange(tmp.PrgProjectFolders.ToArray());
                //lblProjectName.Text = tmp.ProjectName;
                //lblProjectInfo.Text = tmp.ProjectDescription;

                if (tmp != null)
                {
                    myTreeNode trnd = new myTreeNode();
                    trnd.myObject = tmp.ProjectStructure;
                    trnd.Text = tmp.ToString();
                    if (chkShowDeleted.Checked) trnd.Text += "(show deleted)";
                    if (tmp.ProjectStructure != null) AddNodes(trnd, tmp.ProjectStructure.SubItems);
                    treeStep7Project.Nodes.Add(trnd);
                }


            }
        }
示例#38
0
    //复制节点
    private myTreeNode copyOneNode(myTreeNode node)
    {

        if (node == null)
        {
            return new myTreeNode();
        }
        myTreeNode result = new myTreeNode();
        result.Id = node.Id;
        //result.Material = node.Material;
        result.Current = node.Current;
        result.Desc = node.Desc;
        //result.IsModel = node.IsModel;
        // result.IsPart = node.IsPart;      
        //!!!
        result.IsCountStack = false;
        result.CountStack = new Stack();
        result.Value = GetTreeIdIndex();
        result.NavigateUrl = GetURLString(result.Value);
        result.Text = GetNodeText(result.Current, result.Desc, result.Value);

        return result;
    }
示例#39
0
        // для одного node из ICollection
        public void prepare_node_in_collection(ISemanticNode subnode, string node_name, myTreeNode tn_parent, bool is_leaf)
        {
            myTreeNode t;
            if (treeView.SelectedNode == null)
                t = null;
            else
                if (treeView.SelectedNode.Tag == null)
                    t = null;
                else
                    t = treeView.SelectedNode as myTreeNode;

            if (subnode != null)
            {
                myTreeNode tn = new myTreeNode();

                tn.Text = node_name + "   :   " + subnode.GetType().Name;
                tn.Tag = subnode;
                SematicTreeVisitor vs = new SematicTreeVisitor(tn.Nodes);

                tn_parent.Nodes.Add(tn);

                try
                {
                    if (!table_subnodes.ContainsKey(subnode))
                        table_subnodes.Add(subnode, tn);
                }
                catch (System.Exception e)
                {
                    MessageBox.Show("Exception was \n" + e.ToString());
                }

                //treeView.Invalidate();
                //(tn as myTreeNode).is_leaf = is_leaf;
            }
        }
        void loadPrj()
        {
            if (fnm != "")
            {               
                treeStep7Project.Nodes.Clear();

                tmpPrj = Projects.LoadProject(fnm.Split('|')[0], chkShowDeleted.Checked);
                
                lblProjectName.Text = tmpPrj.ProjectName;
                lblProjectInfo.Text = tmpPrj.ProjectDescription;

                myTreeNode trnd = new myTreeNode();
                trnd.myObject = tmpPrj.ProjectStructure;
                trnd.Text = tmpPrj.ProjectStructure.Name;
                trnd.ImageIndex = 0;
                AddNodes(trnd, tmpPrj.ProjectStructure.SubItems);
                treeStep7Project.Nodes.Add(trnd);
            }
        }
示例#41
0
        public void prepare_up_link_node(string str, string text, ISemanticNode sem_node)
        {
            myTreeNode t;
            if (treeView.SelectedNode == null)
                t = null;
            else
                if (treeView.SelectedNode.Tag == null)
                    t = null;
                else
                    t = treeView.SelectedNode as myTreeNode;


            myTreeNode tn = new myTreeNode();
            tn.Tag = sem_node;
            tn.BackColor = System.Drawing.Color.Yellow;

            tn.Text = text + "   :   " + str;
            //tn.Tag = str;

            if (t != null)
                t.Nodes.Add(tn);
            else
                nodes.Add(tn);

            try
            {
                if (!table_up_rows.ContainsKey(tn) && tn != null)
                    table_up_rows.Add(tn, sem_node);
            }
            catch (System.Exception e)
            {
                MessageBox.Show("Exception was \n" + e.ToString());
            }
        }
示例#42
0
        // для строкового поля
        public void prepare_string_node_with_tag(string str, string text, ISemanticNode sem)
        {
            myTreeNode t;
            if (treeView.SelectedNode == null)
                t = null;
            else
                if (treeView.SelectedNode.Tag == null)
                    t = null;
                else
                    t = treeView.SelectedNode as myTreeNode;


            myTreeNode tn = new myTreeNode();

            tn.Text = text + "   :   " + str;
            tn.Tag = sem;
     
            if (t != null)
                t.Nodes.Add(tn);
            else
                nodes.Add(tn);
        }
示例#43
0
        public void prepare_base_node_collection_up_links(ICollection icol, string collection_name, string item_name, int num)
        {
            myTreeNode t;
            if (treeView.SelectedNode == null)
                t = null;
            else
                if (treeView.SelectedNode.Tag == null)
                    t = null;
                else
                    t = treeView.SelectedNode as myTreeNode;

            if (num != 0)
            {
                int i = 0;

                myTreeNode tn = new myTreeNode();

                tn.Text = collection_name + "   Count : " + num.ToString();
                tn.Tag = icol;

                if (t != null)
                    t.Nodes.Add(tn);
                else
                    nodes.Add(tn);
                
            }
            else
            {
                myTreeNode tn = new myTreeNode();

                tn.Text = collection_name + "   Count : 0";
                tn.Tag = icol;

                if (t != null)
                    t.Nodes.Add(tn);
                else
                    nodes.Add(tn);
            }
        }
示例#44
0
        // только для имплементинг интерфейсес

        public void prepare_collection_up_links_list(ICollection icol, string collection_name, string item_name, int num)
        {
            myTreeNode t;
            if (treeView.SelectedNode == null)
                t = null;
            else
                if (treeView.SelectedNode.Tag == null)
                    t = null;
                else
                    t = treeView.SelectedNode as myTreeNode;

            if (num != 0)
            {
                int i = 0;
                if (t == null)
                {
                    myTreeNode tn = new myTreeNode();

                    if (icol.Count != 0)
                        tn.is_leaf = false;
                    else
                        tn.is_leaf = true;

                    tn.Text = collection_name + "   Count : " + num.ToString();
                    tn.Tag = icol;
                    if (t != null)
                        t.Nodes.Add(tn);
                    else
                        nodes.Add(tn);
                    foreach (ISemanticNode sn in icol)
                    {
                        prepare_node_in_collection_up_link(sn, item_name + "[" + i.ToString() + "]", tn);
                        i++;
                    }


                }
                else
                {
                    foreach (ISemanticNode sn in icol)
                    {
                        prepare_node_in_collection_up_link(sn, item_name + "[" + i.ToString() + "]", t);
                        i++;
                    }
                }
            }

            //////if (t != null)
            //////    t.is_built = true;
            //////if (t != null && t.Tag != null)
            //////{
            //////    if ((t.Tag as System.Collections.Generic.List<ITypeNode>).Count != 0)
            //////        t.is_leaf = false;
            //////    else
            //////        t.is_leaf = true;
            //////}


        }
示例#45
0
        // для ICollection
        public void prepare_collection_up_links(ICollection icol, string collection_name, string item_name, int num)
        {
            myTreeNode t;
            if (treeView.SelectedNode == null)
                t = null;
            else
                if (treeView.SelectedNode.Tag == null)
                    t = null;
                else
                    t = treeView.SelectedNode as myTreeNode;

            if (num != 0)
            {
                int i = 0;

                myTreeNode tn = new myTreeNode();

                tn.Text = collection_name + "   Count : " + num.ToString();
                tn.Tag = icol;
    
                if (t != null)
                    t.Nodes.Add(tn);
                else
                    nodes.Add(tn);
                foreach (ISemanticNode sn in icol)
                {
                    prepare_node_in_collection_up_link(sn, item_name + "[" + i.ToString() + "]", tn);
                    i++;
                }
            }
            else
            {
                myTreeNode tn = new myTreeNode();

                tn.Text = collection_name + "   Count : 0";
                tn.Tag = icol;
      
                if (t != null)
                    t.Nodes.Add(tn);
                else
                    nodes.Add(tn);
            }
        }
示例#46
0
        public void prepare_node_in_collection_up_link(ISemanticNode subnode, string node_name, myTreeNode tn_parent)
        {
            myTreeNode t;
            if (treeView.SelectedNode == null)
                t = null;
            else
                if (treeView.SelectedNode.Tag == null)
                    t = null;
                else
                    t = treeView.SelectedNode as myTreeNode;


            if (subnode != null)
            {
                myTreeNode tn = new myTreeNode();

                tn.Tag = subnode;
                tn.BackColor = System.Drawing.Color.Yellow;
                tn.Text = node_name + "   :   " + subnode.GetType().Name;
                tn.is_leaf = true;
                tn_parent.Nodes.Add(tn);

                try
                {
                    if (!table_up_rows.ContainsKey(tn) && tn != null)
                        table_up_rows.Add(tn, subnode);
                }
                catch (System.Exception e)
                {
                    MessageBox.Show("Exception was \n" + e.ToString());
                }
            }
        }
示例#47
0
    private rtInfo DealNodeInfo(myTreeNode node, myTreeNode stNode, string rootValue)
    {
        rtInfo result = new rtInfo();
        if (node.IsCountStack == false)
        {
            for (int i = node.ChildNodes.Count - 1; i >= 0; i--)
            {
                node.CountStack.Push((myTreeNode)node.ChildNodes[i]);
            }
        }

        if (node.CountStack.Count > 0)
        {
            myTreeNode current = (myTreeNode)node.CountStack.Pop();
            myTreeNode treenode = copyOneNode(current);
            stNode.ChildNodes.Add(treenode);
            current.IsCountStack = false;
            result.srcNode = current;
            result.targetNode = treenode;
            //return current;
        }
        else
        {
            if (node.Parent == null || node.Value ==rootValue)
            {
                result.srcNode = null;
                result.targetNode = null;
                //return null;
            }
            else
            {
                ((myTreeNode)node.Parent).IsCountStack = true;
                //current = node.Parent;
                result.srcNode = ((myTreeNode)node.Parent);
                result.targetNode = ((myTreeNode)stNode.Parent);
            }
        }
        return result;
    }
示例#48
0
        public void prepare_string_node_with_tag2(string str, string text, ISemanticNode sem)
        {           
            myTreeNode tn = new myTreeNode();

           myTreeNode t = treeView.Nodes[0] as myTreeNode;

            tn.Text = text + "   :   " + str;
            tn.Tag = sem;
         
            if (t != null)
                t.Nodes.Add(tn);
            else
                nodes.Add(tn);

            treeView.Nodes[0].Text = "compiled_types  : " + "Count " + compiled_types.Count;
        }
示例#49
0
        //--------------------------------------------------------------------------------------------
        //--------------------------------------------------------------------------------------------
        //--------------------------------------------------------------------------------------------
        //--------------------------------------------------------------------------------------------
        //--------------------------------------------------------------------------------------------


        // для обычного node - потомка ISemanticNode
        public void prepare_node(ISemanticNode subnode, string node_name)
        {
            myTreeNode t;
            if (treeView.SelectedNode == null)
                t = null;
            else
                if (treeView.SelectedNode.Tag == null)
                    t = null;
                else
                    t = treeView.SelectedNode as myTreeNode;


            if (subnode != null)
            {
                myTreeNode tn = new myTreeNode();

                tn.Text = node_name + "   :   " + subnode.GetType().Name;
                tn.Tag = subnode;
                SematicTreeVisitor vs = new SematicTreeVisitor(tn.Nodes);
                
                if (t != null)
                    t.Nodes.Add(tn);
                else
                    nodes.Add(tn);

                try
                {
                    if (!table_subnodes.ContainsKey(subnode))
                        table_subnodes.Add(subnode, tn);
                }
                catch (System.Exception e)
                {
                    MessageBox.Show("Exception was \n" + e.ToString());
                }
            }
        }