Beispiel #1
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            String textInForm;

            textInForm = this.textBox1.Text.Clone().ToString();
            Chilkat.Xml xml = new Chilkat.Xml();
            Chilkat.Xml xmlProfiles = new Chilkat.Xml();
            Chilkat.Xml xmlPostes = new Chilkat.Xml();
            Chilkat.Xml xmlTeams = new Chilkat.Xml();
            xmlProfiles.LoadXmlFile("profiles.xml");
            xmlPostes.LoadXmlFile("postes.xml");
            xmlTeams.LoadXmlFile("teams.xml");

            /*foreach (TreeNode ressource in RessourceTree.Nodes)
            {
                foreach (TreeNode childs in ressource.Nodes)
                {
                    //MessageBox.Show(childs.Text, "lol");
                    if (!childs.Text.Contains(textInForm))
                    {
                       // childs.Remove();
                    }
                }
            }*/

            foreach (TreeNode tree in RessourceTree.Nodes[0].Nodes)
            {
                tree.Remove();
            }
            foreach (TreeNode tree in RessourceTree.Nodes[1].Nodes)
            {
                tree.Remove();
            }
            foreach (TreeNode tree in RessourceTree.Nodes[2].Nodes)
            {
                tree.Remove();
            }
            xml = xmlProfiles;
            // Navigate to the first company record.
            xml.FirstChild2();

            while (xml != null)
            {
                // FindNextRecord *will* return the current record if it
                // matches the criteria.
                xml = xml.FindNextRecord("nom", textInForm + "*");
                if (xml != null)
                {
                    // Add the company name to the listbox.

                    RessourceTree.Nodes[0].Nodes.Add(new System.Windows.Forms.TreeNode(xml.GetChildContent("nom") + ", " + xml.GetChildContent("prenom")));

                    // Advance past this record.
                    xml = xml.NextSibling();
                }

            }
            xml = xmlPostes;
            // Navigate to the first company record.
            xml.FirstChild2();

            while (xml != null)
            {
                // FindNextRecord *will* return the current record if it
                // matches the criteria.
                xml = xml.FindNextRecord("nom", textInForm + "*");
                if (xml != null)
                {
                    // Add the company name to the listbox.

                    RessourceTree.Nodes[1].Nodes.Add(new System.Windows.Forms.TreeNode(xml.GetChildContent("nom")));

                    // Advance past this record.
                    xml = xml.NextSibling();
                }

            }
            xml = xmlTeams;
            // Navigate to the first company record.
            xml.FirstChild2();

            while (xml != null)
            {
                // FindNextRecord *will* return the current record if it
                // matches the criteria.
                xml = xml.FindNextRecord("nom", textInForm + "*");
                if (xml != null)
                {
                    // Add the company name to the listbox.

                    RessourceTree.Nodes[2].Nodes.Add(new System.Windows.Forms.TreeNode(xml.GetChildContent("nom")));

                    // Advance past this record.
                    xml = xml.NextSibling();
                }

            }

            /*foreach (Poste poste in posteCharge)
             {
                 if (poste.getNom().Contains(textInForm))
                 {
                     RessourceTree.Nodes[1].Nodes.Add(new System.Windows.Forms.TreeNode(poste.getNom()));
                 }

             }
             foreach (Equipe team in equipe)
             {
                 if (team.getNom().Contains(textInForm))
                 {
                     RessourceTree.Nodes[2].Nodes.Add(new System.Windows.Forms.TreeNode(team.getNom()));
                 }

             }*/
        }