Beispiel #1
0
 public void errorMessage()
 {
     if (this.login.InvokeRequired)
     {
         SetTextCall d = new SetTextCall(errorMessage);  //Thread safe : ajout room à listbox
         this.Invoke(d);
     }
     else
     {
         login.Show();
     }
 }
Beispiel #2
0
 public void addRoomToList(string room)
 {
     if (this.listBox1.InvokeRequired)
     {
         SetTextCall d = new SetTextCall(addRoomToList);  //Thread safe : ajout room à listbox
         this.Invoke(d, new object[] { room });
     }
     else
     {
         Client.rooms.Add(new Room_client(room));
         listBox1.Items.Add(room);
     }
 }
Beispiel #3
0
 public void deleteRoomFromList(string room)
 {
     if (this.listBox1.InvokeRequired)    //Thread safe : suppression room de la Listbox
     {
         SetTextCall d = new SetTextCall(deleteRoomFromList);
         this.Invoke(d, new object[] { room });
     }
     else
     {
         for (int n = listBox1.Items.Count - 1; n >= 0; --n)     //Boucle inverse (sinon problème avec les index)
         {
             if (listBox1.Items[n].ToString().Equals(room))
             {
                 listBox1.Items.RemoveAt(n);
             }
         }
     }
 }