diff --git a/Wpf_AiSportsMicrospace/Common/SportOperate.cs b/Wpf_AiSportsMicrospace/Common/SportOperate.cs index 62092fa..1b4ea44 100644 --- a/Wpf_AiSportsMicrospace/Common/SportOperate.cs +++ b/Wpf_AiSportsMicrospace/Common/SportOperate.cs @@ -34,7 +34,7 @@ namespace Wpf_AiSportsMicrospace.Common private readonly CalcBaseRule _raiseLeftHandRule; private int _leftWaveCount = 0; private int _rightWaveCount = 0; - private const int WaveThreshold = 2; + private const int WaveThreshold = 3; WebcamClient _webcamClient; private DateTime? _wristStartTime = null; diff --git a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs index 74af0bf..a75c697 100644 --- a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs +++ b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs @@ -23,7 +23,7 @@ namespace Wpf_AiSportsMicrospace.MyUserControl private const double CardWidth = 368; private const double CardHeight = 534; private const double CardGap = 30; // 卡片之间水平间距 - private const double SlideDurationMs = 240; // 动画时长 + private const double SlideDurationMs = 300; // 动画时长 private const double ProgressDurationMs = 2600; public int SelectedIndex diff --git a/Wpf_AiSportsMicrospace/Views/CenterHome.xaml.cs b/Wpf_AiSportsMicrospace/Views/CenterHome.xaml.cs index 6d9d82e..3e39d59 100644 --- a/Wpf_AiSportsMicrospace/Views/CenterHome.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/CenterHome.xaml.cs @@ -64,8 +64,6 @@ namespace Wpf_AiSportsMicrospace.Views coverFlow.SelectedIndex = 0; - Loaded += Window_Loaded; - Unloaded += CenterHome_Unloaded; //AnimationBehavior.SetSourceUri(LoadingImage, loadingImage); } diff --git a/Wpf_AiSportsMicrospace/Views/Home.xaml.cs b/Wpf_AiSportsMicrospace/Views/Home.xaml.cs index ae9fc2a..2a864d9 100644 --- a/Wpf_AiSportsMicrospace/Views/Home.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/Home.xaml.cs @@ -34,7 +34,7 @@ namespace Wpf_AiSportsMicrospace private WavingAction _lastGestureAction = WavingAction.None; private DateTime _lastMenuSlideTime = DateTime.MinValue; private bool _isNavigating; - private const int MenuSlideCooldownMs = 220; + private const int MenuSlideCooldownMs = 480; public Home() { diff --git a/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs index 3479f07..4a6d8d5 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/JumpLong/StandingLeap.xaml.cs @@ -60,8 +60,6 @@ namespace Views.JumpLong public StandingLeap() { InitializeComponent(); - Loaded += UserControl_Loaded; - Unloaded += UserControl_Unloaded; _humanPredictor = HumanPredictorFactory.Create(HumanPredictorType.SingleHigh); _humanGraphicsRenderer = new HumanGraphicsRenderer(); _humanGraphicsRenderer.DrawLabel = false; diff --git a/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs index 362abad..7d3e010 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/JumpRope/GroupJumpRope.xaml.cs @@ -71,8 +71,6 @@ namespace Wpf_AiSportsMicrospace.Views public GroupJumpRope() { InitializeComponent(); - Loaded += UserControl_Loaded; - Unloaded += UserControl_Unloaded; _groupJumpRopeContext = new GroupJumpRopeContext(); } @@ -244,9 +242,16 @@ namespace Wpf_AiSportsMicrospace.Views private async void StartCountdown(int start = 3) { - _mainWin.ShowCountDownAnimation(); + if (_isCountdownStarted) + return; + + _isCountdownStarted = true; + if (tipImage != null) + tipImage.Visibility = Visibility.Hidden; + //_currentCountdown = start; Utils.PlayBackgroundMusic("countdown_3.mp3", false); + _mainWin.ShowCountDownAnimation(); //开始人脸识别============================================= //Action handler = null; @@ -281,9 +286,12 @@ namespace Wpf_AiSportsMicrospace.Views //_mainWin.FacialRecognitionEvent += handler; await Task.Delay(3000); - tipImage.Visibility = Visibility.Collapsed; - tipImage.Opacity = 0; - userBox.Children.Remove(tipImage); + if (tipImage != null) + { + tipImage.Visibility = Visibility.Collapsed; + tipImage.Opacity = 0; + userBox.Children.Remove(tipImage); + } FinishCountdown(); } diff --git a/Wpf_AiSportsMicrospace/Views/JumpRope/TrainingRecords.xaml b/Wpf_AiSportsMicrospace/Views/JumpRope/TrainingRecords.xaml index 324d0fc..8e69b29 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpRope/TrainingRecords.xaml +++ b/Wpf_AiSportsMicrospace/Views/JumpRope/TrainingRecords.xaml @@ -7,7 +7,7 @@ mc:Ignorable="d" xmlns:gif="http://wpfanimatedgif.codeplex.com" xmlns:hc="https://handyorg.github.io/handycontrol" - Height="1080" Width="1920" Loaded="UserControl_Loaded"> + Height="1080" Width="1920" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded"> diff --git a/Wpf_AiSportsMicrospace/Views/JumpRope/TrainingRecords.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpRope/TrainingRecords.xaml.cs index 32bbcbd..0976e8c 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpRope/TrainingRecords.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/JumpRope/TrainingRecords.xaml.cs @@ -36,8 +36,6 @@ namespace Views.JumpRope public TrainingRecords() { InitializeComponent(); - Loaded += UserControl_Loaded; - Unloaded += UserControl_Unloaded; //_groupJumpRopeContext = new GroupJumpRopeContext(); LoadData(); } diff --git a/Wpf_AiSportsMicrospace/Views/JumpingJack/BambooDragonfly.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpingJack/BambooDragonfly.xaml.cs index 07153a8..8d40f87 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpingJack/BambooDragonfly.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/JumpingJack/BambooDragonfly.xaml.cs @@ -54,8 +54,6 @@ namespace Views.JumpingJack public BambooDragonfly() { InitializeComponent(); - Loaded += UserControl_Loaded; - Unloaded += UserControl_Unloaded; _groupJumpRopeContext = new GroupJumpRopeContext(); } @@ -232,9 +230,12 @@ namespace Views.JumpingJack private DateTime _lastUpdateTime = DateTime.Now; private void StartCountdown(int start = 3) { - _mainWin.ShowCountDownAnimation(); + if (_isCountdownStarted) + return; + _isCountdownStarted = true; Utils.PlayBackgroundMusic("countdown_3.mp3", false); + _mainWin.ShowCountDownAnimation(); //开始人脸识别============================================= //Action handler = null; diff --git a/Wpf_AiSportsMicrospace/Views/SquatFu/WhackAMole.xaml.cs b/Wpf_AiSportsMicrospace/Views/SquatFu/WhackAMole.xaml.cs index 92fe904..f49319b 100644 --- a/Wpf_AiSportsMicrospace/Views/SquatFu/WhackAMole.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/SquatFu/WhackAMole.xaml.cs @@ -48,8 +48,6 @@ namespace Views.SquatFu public WhackAMole() { InitializeComponent(); - Loaded += UserControl_Loaded; - Unloaded += UserControl_Unloaded; _WhackAMoleContext = new WhackAMoleContext(); } @@ -226,9 +224,15 @@ namespace Views.SquatFu private async void StartCountdown(int start = 3) { - _mainWin.ShowCountDownAnimation(); + if (_isCountdownStarted) + return; + + _isCountdownStarted = true; + if (tipImage != null) + tipImage.Visibility = Visibility.Hidden; Utils.PlayBackgroundMusic("countdown_3.mp3", false); + _mainWin.ShowCountDownAnimation(); //开始人脸识别 ============================================= //Action < VideoFrame > handler = null; @@ -258,9 +262,12 @@ namespace Views.SquatFu // 绑定事件 //_mainWin.FacialRecognitionEvent += handler; await Task.Delay(3000); - tipImage.Visibility = Visibility.Collapsed; // 隐藏提示图片 - tipImage.Opacity = 0; - userListBox.Children.Remove(tipImage); + if (tipImage != null) + { + tipImage.Visibility = Visibility.Collapsed; // 隐藏提示图片 + tipImage.Opacity = 0; + userListBox.Children.Remove(tipImage); + } FinishCountdown(); }