Пример #1
0
 /// <summary>
 /// When new client has disconnected in server mode.
 /// </summary>
 private void Net1_OnClientDisconnected(object sender, ConnectionEventArgs e)
 {
     try
     {
         if (this.InvokeRequired)
         {
             this.BeginInvoke(new ClientDisconnectedEventHandler(Net1_OnClientDisconnected), new object[] { sender, e });
         }
         else
         {
             //Find client and remove it from the list.
             int pos = ClientsList.FindStringExact(e.Info);
             if (pos != -1)
             {
                 ClientsList.Items.RemoveAt(pos);
             }
             else
             {
                 ErrorList.Items.Add("Failed to find item: " + e.Info);
             }
         }
     }
     catch (Exception Ex)
     {
         MessageBox.Show(Ex.Message);
     }
 }