/// <summary> /// Event gets triggered whenever a horse is finished pinging /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void HorseFinished(object sender, EventArgs e) { Horse bestHorse = null; foreach (Horse horse in Horses) { if (horse.Status != HorseStatus.FINISHED) { return; } if (bestHorse == null || bestHorse.Distance < horse.Distance) { bestHorse = horse; } } if (bestHorse == null) { return; } ToastUtil.Notify($"{bestHorse.Name} is the winner!", $"With a total distance of: {bestHorse.Distance}"); MediaUtil.PlaySound("trumpet1.mp3"); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_startRace_OnClick(object sender, RoutedEventArgs e) { _gameController.Start((int)sld_numberOfPings.Value); MediaUtil.PlaySound("gun-shot.mp3"); }