diff --git a/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml b/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml index edaf4f7..93f7d06 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml +++ b/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml @@ -23,8 +23,9 @@ HorizontalAlignment="Left" VerticalAlignment="Top" Margin="1242,301,0,0" Height="438" Width="360"/> diff --git a/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs index 8eeabb1..c4ecfef 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs @@ -22,6 +22,7 @@ using Wpf_AiSportsMicrospace.Common; using Wpf_AiSportsMicrospace.Enum; using Wpf_AiSportsMicrospace.MyUserControl; using Wpf_AiSportsMicrospace.Views; +using WpfAnimatedGif; using Yztob.AiSports.Inferences.Abstractions; using Yztob.AiSports.Inferences.Implement; using Yztob.AiSports.Inferences.Things; @@ -107,7 +108,7 @@ namespace Views.JumpLong int rightWaving = DetectRightHandRaise(humans); if (rightWaving >= 3 && _sportType == 0) //举手完成 开始跳远检测 { - Utils.PlayBackgroundMusic("countdown_3.mp3", false); + _sportType = 1; StartSport(); } @@ -207,13 +208,18 @@ namespace Views.JumpLong private void OnSportTick(int counts, int times) { var ts = TimeSpan.FromSeconds(times); - _ = Dispatcher.BeginInvoke(() => + _ = Dispatcher.BeginInvoke(async () => { //sportCounts.Content = _sport.GetFormatCounts(); //counts.ToString(); //sportTimes.Content = _sport.GetFormatTimes();//ts.ToString(@"mm\'ss\"""); var counts = _sport.GetFormatCounts(); if (double.Parse(counts[..^1]) > 0 && _sportType == 1) //正向跳远时候&&处于测试阶段时候触发更新 { + + ImageBehavior.SetRepeatBehavior(centerImg4, new RepeatBehavior(2)); + ImageBehavior.SetRepeatBehavior(centerImg4, new RepeatBehavior(1)); + ImageBehavior.GetAnimationController(centerImg4).Play(); + await Task.Delay(800); _sport.Stop();//关闭运动 _mainWin.FacialRecognitionEvent -= this.HumanPredicting; count.Text = counts; @@ -250,10 +256,18 @@ namespace Views.JumpLong //centerImg3.Opacity = 1; _sportType = 2; RankingGrid.BeginAnimation(UIElement.OpacityProperty, fadeInAnimation); + ImageBehavior.GetAnimationController(centerImg4).Pause(); + //_mainWin.WebcamClient.OnExtractFrame -= this.OnFrameExtracted; for (int i = 12; i >= 0; i--) { countDown.Text = i.ToString() + "s"; + + if(i == 8) + { + centerImg4.Visibility = Visibility.Hidden; + centerImg3.Visibility = Visibility.Visible; + } if (i == 1) { RankingGrid.BeginAnimation(UIElement.OpacityProperty, fadeInAnimation1); @@ -510,7 +524,10 @@ namespace Views.JumpLong private void StartSport() { - + Utils.PlayBackgroundMusic("countdown_3.mp3", false); + _mainWin.ShowCountDownAnimation(); + centerImg3.Visibility = Visibility.Hidden; + centerImg4.Visibility = Visibility.Visible; //if (_sport?.IsCounting == true) //_mainWin.WebcamClient.OnExtractFrame += this.OnFrameExtracted; _sport.Start(); @@ -520,6 +537,7 @@ namespace Views.JumpLong _mainWin.FacialRecognitionEvent += this.HumanPredicting; } + private WriteableBitmap _videoBitmap; private int _lastFrameNumber = -1; private async void OnFrameExtracted(VideoFrame frame)