コード例 #1
0
        void loadlist()
        {
            serverlist.Items.Clear();
            try
            {
                mongoxml.loaddoc("./config/config.xml");
                XmlNodeList servernodes = mongoxml.getnodes();

                int nodecout = servernodes.Count;
                for (int i = 0; i < nodecout; i++)
                {
                    serverinfo sinfo = new serverinfo();
                    sinfo.servername = servernodes.Item(i).Attributes["name"].Value;
                    sinfo.ip         = servernodes.Item(i).Attributes["ip"].Value;
                    sinfo.port       = servernodes.Item(i).Attributes["port"].Value;

                    info.Add(sinfo);
                }

                int servercout = info.Count;
                for (int i = 0; i < servercout; i++)
                {
                    serverlist.Items.Add(info[i].servername);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
ファイル: AddLogin.xaml.cs プロジェクト: wangmengcn/MongoMgr
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string name       = this.servername.Text;
            string serverip   = this.ip.Text;
            string serverport = this.port.Text;


            try
            {
                mongoxml.loaddoc("./config/config.xml");
                mongoxml.AddXMLNode(name, serverip, serverport);
                //MessageBox.Show("添加成功");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            MongoXML mongoxml = new MongoXML();
            if(name!="")
            {
                 name = this.modservername.Text;
                 ip = this.modip.Text;
                 port = this.modport.Text;


                try
                {
                    mongoxml.loaddoc("./config/config.xml");
                    mongoxml.ModifyNode(name, ip, port);
                    //MessageBox.Show("添加成功");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
コード例 #4
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            MongoXML mongoxml = new MongoXML();

            if (name != "")
            {
                name = this.modservername.Text;
                ip   = this.modip.Text;
                port = this.modport.Text;


                try
                {
                    mongoxml.loaddoc("./config/config.xml");
                    mongoxml.ModifyNode(name, ip, port);
                    //MessageBox.Show("添加成功");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }