private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { ConfForm confform = new ConfForm(); confform.Show(this); getConfig(); }
private void getConfig() { XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.Load(ConfFilePath); //userClient = new UserClient(); XmlElement rootNode = xmlDoc.DocumentElement; XmlNode node = rootNode.SelectSingleNode("Server"); userClient.serverIp = IPAddress.Parse(node.SelectSingleNode("IPAddress").InnerText); userClient.serverPort = Int32.Parse(node.SelectSingleNode("Port").InnerText); } catch (Exception ex) { MessageBox.Show("加载配置文件异常"); ConfForm confform = new ConfForm(); confform.Show(this); } }