页面跳转

This commit is contained in:
tanglong 2025-09-26 12:12:35 +08:00
parent 1ca82f99a6
commit 638f039aab

View File

@ -87,14 +87,18 @@ namespace Wpf_AiSportsMicrospace
// 停止抽帧线程/释放资源
try
{
_webcamClient?.StopExtract(); // 停止抽帧
_webcamClient = null; // 释放引用
_cts.Cancel(); // 停止后台处理线程
_webcamClient?.StopExtract(); // 停止摄像头抽帧
_webcamClient = null;
}
catch (Exception ex)
{
Debug.WriteLine($"停止抽帧异常: {ex.Message}");
}
// 解绑事件,防止重复触发
coverFlow.ProgressCompleted -= CoverFlow_ProgressCompleted;
// 根据图片跳转新窗口
string uri = item.ImageUri.ToString();
Window newWindow = null;
@ -134,7 +138,6 @@ namespace Wpf_AiSportsMicrospace
}, _cts.Token);
}
private void ProcessFrame(VideoFrame frame)
{
try
@ -159,27 +162,34 @@ namespace Wpf_AiSportsMicrospace
//检测挥手动作
var wavingaction = _sportOperate.VerifyWavingAction(human);
switch (wavingaction)
{
case (int)WavingAction.LeftWave: // 1
Dispatcher.BeginInvoke(() => coverFlow.SlideLeft());
break;
case (int)WavingAction.RightWave: // 2
Dispatcher.BeginInvoke(() => coverFlow.SlideRight());
break;
case (int)WavingAction.RaiseHand: // 3 举手完成
coverFlow.ProgressCompleted += CoverFlow_ProgressCompleted;
break;
case (int)WavingAction.Raising: // 4 举手中
break;
case 5: // 如果还有其他动作
Dispatcher.BeginInvoke(() => coverFlow.StartSelectedProgress());
break;
default:
Dispatcher.BeginInvoke(() => coverFlow.CancelSelectedProgress());
break;
}
if (wavingaction == (int)WavingAction.Raising)
{
return;
}
else
{
switch (wavingaction)
{
case (int)WavingAction.LeftWave: // 1
Dispatcher.BeginInvoke(() => coverFlow.SlideLeft());
break;
case (int)WavingAction.RightWave: // 2
Dispatcher.BeginInvoke(() => coverFlow.SlideRight());
break;
case (int)WavingAction.RaiseHand: // 3 举手完成
coverFlow.ProgressCompleted -= CoverFlow_ProgressCompleted;
coverFlow.ProgressCompleted += CoverFlow_ProgressCompleted;
break;
case (int)WavingAction.Raising: // 4 举手中
break;
case 5: // 如果还有其他动作
Dispatcher.BeginInvoke(() => coverFlow.StartSelectedProgress());
break;
default:
break;
}
}
}
catch (Exception ex)
{