完成事件

This commit is contained in:
tanglong 2025-09-25 17:37:12 +08:00
parent 9a646dbb3c
commit fb1707bff7
2 changed files with 27 additions and 2 deletions

View File

@ -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(() =>

View File

@ -26,6 +26,8 @@ namespace Wpf_AiSportsMicrospace.MyUserControl
/// </summary>
public partial class CoverFlowControl1 : UserControl
{
// 新增事件:进度条完成
public event Action<CoverFlowItem> ProgressCompleted;
public ObservableCollection<CoverFlowItem> Images { get; set; } = new ObservableCollection<CoverFlowItem>();
private int _selectedIndex = 0;
@ -113,6 +115,7 @@ namespace Wpf_AiSportsMicrospace.MyUserControl
}
else
{
ProgressCompleted?.Invoke(_currentItem);
// 停止动画
StopProgress();
}