From daa1160c232c7cdd56af1b701358f74c62f696b6 Mon Sep 17 00:00:00 2001 From: tanglong <842690096@qq.com> Date: Wed, 13 May 2026 12:10:49 +0800 Subject: [PATCH] =?UTF-8?q?ai=E4=BC=98=E5=8C=9611?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyUserControl/CoverFlowControl.xaml | 3 ++- .../MyUserControl/CoverFlowControl.xaml.cs | 6 +++--- Wpf_AiSportsMicrospace/Views/Home.xaml.cs | 15 +++++++++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml index 5830f47..89bf653 100644 --- a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml +++ b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml @@ -114,7 +114,8 @@ Width="1474" Height="580" Background="Transparent" - RenderOptions.BitmapScalingMode="LowQuality" + RenderOptions.BitmapScalingMode="Linear" + UseLayoutRounding="True" Focusable="True" PreviewKeyDown="Carousel_PreviewKeyDown" PreviewMouseWheel="Carousel_PreviewMouseWheel"> diff --git a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs index 4083a24..716c1f8 100644 --- a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs +++ b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs @@ -23,7 +23,7 @@ namespace Wpf_AiSportsMicrospace.MyUserControl private const double CardWidth = 368; private const double CardHeight = 534; private const double CardGap = 30; // 卡片之间水平间距 - private const double SlideDurationMs = 130; // 动画时长 + private const double SlideDurationMs = 180; // 动画时长 private const double ProgressDurationMs = 2600; public int SelectedIndex @@ -297,7 +297,7 @@ namespace Wpf_AiSportsMicrospace.MyUserControl SetCard(CardSpare, incomingRight, XOffRight, 1); var sb = new Storyboard { FillBehavior = FillBehavior.Stop }; - var ease = new CubicEase { EasingMode = EasingMode.EaseOut }; + var ease = new SineEase { EasingMode = EasingMode.EaseInOut }; var dur = TimeSpan.FromMilliseconds(SlideDurationMs); void AddMove(FrameworkElement fe, double toX) @@ -379,7 +379,7 @@ namespace Wpf_AiSportsMicrospace.MyUserControl SetCard(CardSpare, incomingFarLeft, XOffLeft, 1); var sb = new Storyboard { FillBehavior = FillBehavior.Stop }; - var ease = new CubicEase { EasingMode = EasingMode.EaseOut }; + var ease = new SineEase { EasingMode = EasingMode.EaseInOut }; var dur = TimeSpan.FromMilliseconds(SlideDurationMs); void AddMove(FrameworkElement fe, double toX) diff --git a/Wpf_AiSportsMicrospace/Views/Home.xaml.cs b/Wpf_AiSportsMicrospace/Views/Home.xaml.cs index 0bb7c25..cf49931 100644 --- a/Wpf_AiSportsMicrospace/Views/Home.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/Home.xaml.cs @@ -136,7 +136,7 @@ namespace Wpf_AiSportsMicrospace _lastMenuSlideTime = now; _menuWaveConsumed = true; _lastGestureAction = wavingaction; - Dispatcher.BeginInvoke(() => coverFlow.SlideRight(), DispatcherPriority.Input); + ExecuteMenuSlide(() => coverFlow.SlideRight()); break; case WavingAction.RightWave: // 右手挥动 @@ -149,7 +149,7 @@ namespace Wpf_AiSportsMicrospace _lastMenuSlideTime = now; _menuWaveConsumed = true; _lastGestureAction = wavingaction; - Dispatcher.BeginInvoke(() => coverFlow.SlideLeft(), DispatcherPriority.Input); + ExecuteMenuSlide(() => coverFlow.SlideLeft()); break; case WavingAction.FirstHand: // 举手开始 @@ -183,6 +183,17 @@ namespace Wpf_AiSportsMicrospace } //测试点击 + private void ExecuteMenuSlide(Action slideAction) + { + if (Dispatcher.CheckAccess()) + { + slideAction(); + return; + } + + Dispatcher.BeginInvoke(slideAction, DispatcherPriority.Send); + } + private async void GoNew(object sender, MouseButtonEventArgs e) { RouterGoNew();