This commit is contained in:
tanglong 2025-10-21 17:41:08 +08:00
parent 3057f34cda
commit 452ed85339

View File

@ -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<Human> humans)
@ -48,13 +51,17 @@ namespace Views.JumpRope
int leftWaving = DetectLeftHandRaise(humans);
if (leftWaving == 5)
{
_mainWin.HumanFrameUpdated -= OnHumanFrameUpdated;
_mainWin.WebcamClient.StopExtract();
// 举左手逻辑,例如结束动画或退出
var newPage = new Home();
//_mainWin.HumanFrameUpdated -= OnHumanFrameUpdated;
if(newPage == null)
{
newPage = new Home();
_mainWin?.SwitchPageWithMaskAnimation(newPage, true);
}
// 举左手逻辑,例如结束动画或退出
//return;
//_mainWin.WebcamClient.StopExtract();
}
}
catch (Exception ex)
@ -66,7 +73,6 @@ namespace Views.JumpRope
public void LoadData()
{
_groupJumpRopeContext = new GroupJumpRopeContext();
ShowRankingBoard(_groupJumpRopeContext.UpdateRankList());
}
public void ShowRankingBoard(List<RankItem> list)