From fb1707bff714721793c3f537638e75f2a3a24e15 Mon Sep 17 00:00:00 2001 From: tanglong <842690096@qq.com> Date: Thu, 25 Sep 2025 17:37:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Wpf_AiSportsMicrospace/Home.xaml.cs | 26 +++++++++++++++++-- .../MyUserControl/CoverFlowControl1.xaml.cs | 3 +++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Wpf_AiSportsMicrospace/Home.xaml.cs b/Wpf_AiSportsMicrospace/Home.xaml.cs index fb175ca..96fcee9 100644 --- a/Wpf_AiSportsMicrospace/Home.xaml.cs +++ b/Wpf_AiSportsMicrospace/Home.xaml.cs @@ -15,6 +15,7 @@ using System.Windows.Media; using System.Windows.Media.Animation; using Wpf_AiSportsMicrospace.Common; using Wpf_AiSportsMicrospace.MyUserControl; +using Yunzhi.Database; using Yztob.AiSports.Inferences.Abstractions; using Yztob.AiSports.Postures; using Yztob.AiSports.Postures.Abstractions; @@ -66,11 +67,12 @@ namespace Wpf_AiSportsMicrospace coverFlow.Images.Add(new CoverFlowItem { ImageUri = new Uri(Path.Combine(albumPath, "1.jpg")) }); coverFlow.Images.Add(new CoverFlowItem { ImageUri = new Uri(Path.Combine(albumPath, "2.jpg")) }); coverFlow.Images.Add(new CoverFlowItem { ImageUri = new Uri(Path.Combine(albumPath, "3.jpg")) }); - coverFlow.Images.Add(new CoverFlowItem { ImageUri = new Uri(Path.Combine(albumPath, "4.jpg")) }); - coverFlow.Images.Add(new CoverFlowItem { ImageUri = new Uri(Path.Combine(albumPath, "5.jpg")) }); // 默认选中第3张 coverFlow.SelectedIndex = 2; + + // 监听进度条完成事件 + coverFlow.ProgressCompleted += CoverFlow_ProgressCompleted; } private void Window_Loaded(object sender, RoutedEventArgs e) @@ -88,6 +90,26 @@ namespace Wpf_AiSportsMicrospace StartFrameProcessing(); } + private void CoverFlow_ProgressCompleted(CoverFlowItem item) + { + // 根据不同图片跳转不同页面 + if (item.ImageUri.ToString().EndsWith("1.jpg")) + { + // 跳转到页面1 + MessageBox.Show("1.jpg"); + } + else if (item.ImageUri.ToString().EndsWith("2.jpg")) + { + // 跳转到页面2 + MessageBox.Show("2.jpg"); + } + else if (item.ImageUri.ToString().EndsWith("3.jpg")) + { + // 跳转到页面3 + MessageBox.Show("3.jpg"); + } + } + private void StartFrameProcessing() { Task.Run(() => diff --git a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl1.xaml.cs b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl1.xaml.cs index 35d1147..b08cd03 100644 --- a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl1.xaml.cs +++ b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl1.xaml.cs @@ -26,6 +26,8 @@ namespace Wpf_AiSportsMicrospace.MyUserControl /// public partial class CoverFlowControl1 : UserControl { + // 新增事件:进度条完成 + public event Action ProgressCompleted; public ObservableCollection Images { get; set; } = new ObservableCollection(); private int _selectedIndex = 0; @@ -113,6 +115,7 @@ namespace Wpf_AiSportsMicrospace.MyUserControl } else { + ProgressCompleted?.Invoke(_currentItem); // 停止动画 StopProgress(); }