Exemple #1
0
 private void button_parameter_Click(object sender, EventArgs e)
 {
     try
     {
         if (m_clientSocket != null && m_clientSocket.GetSocketState())
         {
             if (m_pw == null || m_pw.IsDisposed)
             {
                 m_pw = new ParameterWindow(m_clientSocket);
                 m_pw.Show();
             }
             else
             {
                 m_pw.Activate();
             }
         }
         else
         {
             this.button_parameter.Enabled = false;
             this.button_RunOnce.Enabled   = false;
             this.button_restart.Enabled   = false;
             MessageBox.Show("请先连接到服务器!");
         }
     }
     catch (System.Exception)
     {
         this.button_parameter.Enabled = false;
         this.button_RunOnce.Enabled   = false;
         this.button_restart.Enabled   = false;
         MessageBox.Show("服务器异常退出, 请重新连接!");
     }
 }
 //参数设置按钮事件
 private void button_parameter_Click(object sender, EventArgs e)
 {
     try
     {
         //如果网络连接正常
         if (m_clientSocket != null && m_clientSocket.GetSocketState())
         {
             if (m_pw == null || m_pw.IsDisposed) //如果还未打开参数设置对话框
             {
                 m_pw = new ParameterWindow(m_clientSocket);
                 m_pw.Show(); //创建并显示参数设置对话框
             }
             else //如果已打开参数设置对话框
             {
                 m_pw.Activate(); //激活参数设置对话框
             }
         }
         else //如果网络连接不正常
         {
             this.button_parameter.Enabled = false; //参数设置按钮无效
             this.button_RunOnce.Enabled   = false; //运行一次按钮无效
             this.button_restart.Enabled   = false; //服务器重启按钮无效
             MessageBox.Show("请先连接到服务器!");
         }
     }
     catch (System.Exception)                   //如果发生异常
     {
         this.button_parameter.Enabled = false; //参数设置按钮无效
         this.button_RunOnce.Enabled   = false; //运行一次按钮无效
         this.button_restart.Enabled   = false; //服务器重启按钮无效
         MessageBox.Show("服务器异常退出, 请重新连接!");
     }
 }