diff --git a/Wpf_AiSportsMicrospace/Views/JumpRope/TrainingRecords.xaml.cs b/Wpf_AiSportsMicrospace/Views/JumpRope/TrainingRecords.xaml.cs index 5266c73..e9335ec 100644 --- a/Wpf_AiSportsMicrospace/Views/JumpRope/TrainingRecords.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/JumpRope/TrainingRecords.xaml.cs @@ -26,10 +26,12 @@ namespace Views.JumpRope { private Main _mainWin => Application.Current.MainWindow as Main; private GroupJumpRopeContext _groupJumpRopeContext; + UserControl newPage = null; public TrainingRecords() { InitializeComponent(); Loaded += UserControl_Loaded; + _groupJumpRopeContext = new GroupJumpRopeContext(); LoadData(); } @@ -37,6 +39,7 @@ namespace Views.JumpRope { Utils.PlayBackgroundMusic("homeprojectselected.mp3", true); _mainWin.HumanFrameUpdated += OnHumanFrameUpdated; + _mainWin.WebcamClient.StartExtract(); } private void OnHumanFrameUpdated(object sender, List humans) @@ -48,12 +51,16 @@ namespace Views.JumpRope int leftWaving = DetectLeftHandRaise(humans); if (leftWaving == 5) { - _mainWin.HumanFrameUpdated -= OnHumanFrameUpdated; - _mainWin.WebcamClient.StopExtract(); - + //_mainWin.HumanFrameUpdated -= OnHumanFrameUpdated; + if(newPage == null) + { + newPage = new Home(); + _mainWin?.SwitchPageWithMaskAnimation(newPage, true); + } // 举左手逻辑,例如结束动画或退出 - var newPage = new Home(); - _mainWin?.SwitchPageWithMaskAnimation(newPage, true); + + //return; + //_mainWin.WebcamClient.StopExtract(); } } @@ -66,7 +73,6 @@ namespace Views.JumpRope public void LoadData() { - _groupJumpRopeContext = new GroupJumpRopeContext(); ShowRankingBoard(_groupJumpRopeContext.UpdateRankList()); } public void ShowRankingBoard(List list)