private void Delete_Last_Ballon(object sender, RoutedEventArgs e) { if (IsThereAnyRunningBallon()) { MyThread lastBallon = listRunningThreads.FindLast(mt => MyThread.IsBallonThread(mt)); if (lastBallon != null) { nbBallons--; Thread lbt = listThreads.FindLast(t => t.ManagedThreadId == lastBallon.Id); lbt.Abort(); listThreads.Remove(lbt); listRunningThreads.Remove(lastBallon); UpdateListBox(); } } else { ShowWarningDialog("ballon"); } }
private void Delete_Last_Premier(object sender, RoutedEventArgs e) { if (IsThereAnyRunningPremier()) { MyThread lastPremier = listRunningThreads.FindLast(mt => MyThread.IsPremierThread(mt)); if (lastPremier != null) { nbPremiers--; Thread lpt = listThreads.FindLast(t => t.ManagedThreadId == lastPremier.Id); lpt.Abort(); listThreads.Remove(lpt); listRunningThreads.Remove(lastPremier); UpdateListBox(); } } else { ShowWarningDialog("premier"); } }
public static bool IsPremierThread(MyThread mt) { return(mt.Type == "premier"); }
public static bool IsBallonThread(MyThread mt) { return(mt.Type == "ballon"); }