コード例 #1
0
 private async void Storyboard_Completed(object sender, object e)
 {
     if (_state == RacerState.Started)
     {
         Storyboard storyboard = (Storyboard)sender;
         TimeSpan   duration   = storyboard.GetCurrentTime();
         Racer      racer      = (Racer)_items.FirstOrDefault(w => ((Racer)w.Tag).Time == duration).Tag;
         _count++;
         if (_count == 1)
         {
             _winner = racer.Option;
             string name = Enum.GetName(typeof(RacerOption), _winner);
             await ShowDialogAsync($"{name} completed Race in {duration.ToString()}");
         }
         if (_count == total)
         {
             _state = RacerState.Finished;
             ShowMessage();
         }
         _finished = true;
     }
 }