Пример #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            rootNode1 = new TreeNode("客户终端", 5, 5);
            this.deviceTree.Nodes.Add(rootNode1);
            rootNode2 = new TreeNode("服务器终端", 6, 6);
            this.deviceTree.Nodes.Add(rootNode2);

            try
            {
                //SocketInfo[] sis = MySerializer.DeSerialize(XMLFileName);
                socketInfoList = MySerializer.Deserialize <List <SocketInfo> >(XMLFileName);
                //SocketInfo[] sis = MySerializer.Deserialize<SocketInfo[]>(XMLFileName);

                foreach (SocketInfo si in socketInfoList)
                {
                    if (si.Type == "Server")
                    {
                        AddServerFormNode(si.Name, si);
                    }
                    else
                    {
                        AddClientFormNode(si.Name, si);
                    }
                }
            }
            catch (System.Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
            }
        }
Пример #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     this.rootNode1 = new TreeNode("客户终端", 5, 5);
     this.deviceTree.Nodes.Add(this.rootNode1);
     this.rootNode2 = new TreeNode("服务器终端", 6, 6);
     this.deviceTree.Nodes.Add(this.rootNode2);
     try
     {
         this.socketInfoList = MySerializer.Deserialize <List <SocketInfo> >(this.XMLFileName);
         foreach (SocketInfo current in this.socketInfoList)
         {
             if (current.Types == "Server")
             {
                 this.AddServerFormNode(current.Names, current);
             }
             else
             {
                 this.AddClientFormNode(current.Names, current);
             }
         }
     }
     catch (Exception)
     {
     }
 }