Exemplo n.º 1
0
        private void Connect_Click(object sender, EventArgs e)
        {
            string ipstr = this.IpTextBox.Text;
            int    port  = Convert.ToInt32(this.PortTextBox.Text);

            if (ConnectManager.IsConnected)
            {
                if (MessageBox.Show(this, "当前已连接至服务器,是否断开连接使用新连接?", "WARNNING", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                {
                    ConnectManager.DisConnect();
                }
                else
                {
                    return;
                }
            }
            else
            {
                if (ConnectManager.ConnectToServer(ipstr, port))
                {
                    MessageBox.Show("连接成功!");
                }
                else
                {
                    MessageBox.Show("连接失败!");
                }
            }
        }
Exemplo n.º 2
0
 private void Menu_Start_LinkToServer_Click(object sender, EventArgs e)
 {
     if (!ConnectManager.ConnectToServer())
     {
         MessageBox.Show(this, "连接服务器失败!", "WARNNING", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         Logger.LogError("连接失败!");
     }
     else
     {
         MessageBox.Show(this, "连接服务器成功!", "SUCCEED", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }