Ejemplo n.º 1
0
 private void btnDisconn_Click(object sender, EventArgs e)
 {
     try
     {
         IntPtr connId = (IntPtr)Convert.ToInt32(this.txtDisConn.Text.Trim());
         // 断开指定客户
         if (server.Disconnect(connId, true))
         {
             AddMsg(string.Format("$({0}) Disconnect OK", connId));
         }
         else
         {
             throw new Exception(string.Format("Disconnect({0}) Error", connId));
         }
     }
     catch (Exception ex)
     {
         AddMsg(ex.Message);
     }
 }
Ejemplo n.º 2
0
        private void buttonDisconnect_Click(object sender, EventArgs e)
        {
            if (checkedListBoxClientList.Items.Count > 0)
            {
                try
                {
                    for (int i = 0; i < checkedListBoxClientList.Items.Count; i++)
                    {
                        IntPtr connId = (IntPtr)Convert.ToInt32(checkedListBoxClientList.Items[i]);

                        if (checkedListBoxClientList.GetItemChecked(i))
                        {
                            server.Disconnect(connId, true);
                        }
                    }
                }
                catch (Exception exc)
                {
                    ShowMSG(exc.Message);
                }
            }
        }