Example #1
0
 private void FinishRace()
 {
     _timer.Stop();
     _timer.Elapsed -= OnTimedEvent;
     RaceFinished?.Invoke(this, new RaceFinishedEventArgs(GetFinishedPlacements()));
     if (DriversChanged != null)
     {
         foreach (Delegate d in DriversChanged.GetInvocationList())
         {
             DriversChanged -= (EventHandler <DriversChangedEventArgs>)d;
         }
     }
 }
Example #2
0
 public void CleanupEvents()
 {
     Delegate[] delegates = DriversChanged?.GetInvocationList();
     if (delegates != null)
     {
         foreach (var d in delegates)
         {
             DriversChanged -= (EventHandler)d;
         }
     }
     delegates = NextRace?.GetInvocationList();
     if (delegates != null)
     {
         foreach (var d in delegates)
         {
             NextRace -= (EventHandler)d;
         }
     }
 }