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();