示例#1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string addressString = this.textBox1.Text.Trim();

            if (addressString != "")
            {
                if (!(!(addressString != "localhost:1263") || Common.IPAddressCheck(addressString)))
                {
                    MessageBox.Show("IP地址不合法!");
                }
                else
                {
                    Regedit.Save("Server", "WebService", addressString);
                    string str2 = Test(addressString);
                    if ((str2 == string.Empty) || (str2 == null))
                    {
                        MessageBox.Show("连接失败!退出登录!");
                        base.Close();
                    }
                    else
                    {
                        Regedit.Save("Server", "WebService", addressString);
                        base.DialogResult = DialogResult.OK;
                        base.Close();
                    }
                }
            }
        }
示例#2
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            string addressString = this.textBox1.Text.Trim();

            if (addressString != "")
            {
                if (!(!(addressString != "localhost:1263") || Common.IPAddressCheck(addressString)))
                {
                    MessageBox.Show("IP地址不合法!");
                }
                else
                {
                    string str2 = Test(addressString);
                    if ((str2 == string.Empty) || (str2 == null))
                    {
                        MessageBox.Show("连接失败!");
                    }
                    else
                    {
                        MessageBox.Show("连接成功!\r\n" + str2);
                        Regedit.Save("Server", "WebService", addressString);
                    }
                }
            }
        }