diff --git a/Ink Canvas/App.xaml.cs b/Ink Canvas/App.xaml.cs index 639268bd..c2d05853 100644 --- a/Ink Canvas/App.xaml.cs +++ b/Ink Canvas/App.xaml.cs @@ -775,10 +775,9 @@ namespace Ink_Canvas // 根据设置决定是否显示启动画面 if (ShouldShowSplashScreen() && !IsLaunchByFileOrUri(e.Args)) { - await Task.Delay(100); ShowSplashScreen(); SetSplashMessage(Strings.GetString("Splash_Starting")); - SetSplashProgress(20); + SetSplashProgress(25); // 强制刷新UI,确保启动画面显示 Application.Current.Dispatcher.Invoke(() => { }, DispatcherPriority.Render); @@ -815,24 +814,12 @@ namespace Ink_Canvas LogHelper.WriteLogToFile("App | 检测到最终应用启动(更新后的应用)"); } - // 释放IACore相关DLL - if (_isSplashScreenShown) - { - SetSplashMessage("正在初始化组件..."); - SetSplashProgress(40); - } - - // 释放UIAccess DLL - if (_isSplashScreenShown) - { - SetSplashMessage("正在初始化组件..."); - SetSplashProgress(50); - } if (_isSplashScreenShown) { SetSplashMessage("正在加载配置..."); - SetSplashProgress(60); + SetSplashProgress(50); + await Task.Delay(100); } // 处理更新模式启动 @@ -1105,7 +1092,7 @@ namespace Ink_Canvas if (_isSplashScreenShown) { SetSplashMessage("正在初始化主界面..."); - SetSplashProgress(80); + SetSplashProgress(75); } var mainWindow = new MainWindow(); MainWindow = mainWindow; @@ -1150,16 +1137,14 @@ namespace Ink_Canvas if (_isSplashScreenShown) { - SetSplashMessage("完成初始化..."); - SetSplashProgress(80); - Task.Delay(300).ContinueWith(_ => + SetSplashMessage("启动完成!"); + SetSplashProgress(100); + Task.Delay(100).ContinueWith(_ => { Dispatcher.Invoke(() => { - SetSplashMessage("启动完成!"); - SetSplashProgress(100); // 延迟关闭启动画面,让用户看到完成消息 - Task.Delay(500).ContinueWith(__ => + Task.Delay(100).ContinueWith(__ => { Dispatcher.Invoke(() => CloseSplashScreen()); }); diff --git a/Ink Canvas/MainWindow.xaml.cs b/Ink Canvas/MainWindow.xaml.cs index a872cc25..5dabdb55 100644 --- a/Ink Canvas/MainWindow.xaml.cs +++ b/Ink Canvas/MainWindow.xaml.cs @@ -1197,8 +1197,6 @@ namespace Ink_Canvas Helpers.DebugConsoleManager.Show(); } - _ = TelemetryUploader.UploadTelemetryIfNeededAsync(); - LoadCustomBackgroundColor(); SetWindowMode(); @@ -1296,11 +1294,6 @@ namespace Ink_Canvas // 应用无焦点模式设置 ApplyNoFocusMode(); - // 应用窗口置顶设置 - Dispatcher.BeginInvoke(new Action(() => - { - ApplyAlwaysOnTop(); - }), DispatcherPriority.ApplicationIdle); // 设置UIA置顶状态 App.IsUIAccessTopMostEnabled = Settings.Advanced.EnableUIAccessTopMost; @@ -1311,18 +1304,6 @@ namespace Ink_Canvas _ = RunDeferredStartupPhaseBAsync(); - Dispatcher.BeginInvoke(new Action(() => - { - LoadInkFadeSettings(); - LoadBrushAutoRestoreSettings(); - }), DispatcherPriority.ApplicationIdle); - - // 初始化墨迹渐隐管理器 - Dispatcher.BeginInvoke(new Action(() => - { - InitializeInkFadeManager(); - }), DispatcherPriority.ApplicationIdle); - // 处理命令行参数中的文件路径 HandleCommandLineFileOpen(); @@ -1420,12 +1401,6 @@ namespace Ink_Canvas }; } }), DispatcherPriority.Loaded); - Dispatcher.BeginInvoke(new Action(() => - { - if (_sliderTouchSupportInitialized) return; - AddTouchSupportToSliders(); - _sliderTouchSupportInitialized = true; - }), DispatcherPriority.ApplicationIdle); } private void ApplyLanguageFromSettings() @@ -2311,6 +2286,27 @@ namespace Ink_Canvas InitializeFloatingWindowInterceptor(); InitializeGlobalHotkeyManager(); + _ = TelemetryUploader.UploadTelemetryIfNeededAsync(); + + _ = Dispatcher.BeginInvoke(new Action(() => + { + ApplyAlwaysOnTop(); + }), DispatcherPriority.ApplicationIdle); + + _ = Dispatcher.BeginInvoke(new Action(() => + { + LoadInkFadeSettings(); + LoadBrushAutoRestoreSettings(); + InitializeInkFadeManager(); + }), DispatcherPriority.ApplicationIdle); + + _ = Dispatcher.BeginInvoke(new Action(() => + { + if (_sliderTouchSupportInitialized) return; + AddTouchSupportToSliders(); + _sliderTouchSupportInitialized = true; + }), DispatcherPriority.ApplicationIdle); + try { string savePath = Settings.Automation.AutoSavedStrokesLocation; diff --git a/Ink Canvas/Windows/OobeWindow.xaml b/Ink Canvas/Windows/OobeWindow.xaml index 09c615c0..1ea47654 100644 --- a/Ink Canvas/Windows/OobeWindow.xaml +++ b/Ink Canvas/Windows/OobeWindow.xaml @@ -8,7 +8,7 @@ xmlns:controls="clr-namespace:Ink_Canvas.Controls;assembly=InkCanvas.Controls" xmlns:sys="clr-namespace:System;assembly=mscorlib" mc:Ignorable="d" - Title="欢迎使用 InkCanvasForClass" + Title="欢迎使用 InkCanvasForClass CE" Height="700" Width="1080" MinHeight="520" @@ -68,7 +68,7 @@ @@ -167,7 +167,7 @@ RenderOptions.BitmapScalingMode="HighQuality" /> - 0) - { - MessageBox.Show(this, - "请先勾选\"我已阅读并同意《隐私协议》\"后再继续。", - "需要同意隐私协议", - MessageBoxButton.OK, - MessageBoxImage.Information); - SyncNavSelection(); - return; - } - int direction = target > _currentStep ? 1 : -1; NavigateTo(target, direction); } @@ -405,6 +382,7 @@ namespace Ink_Canvas.Windows private void HyperlinkPrivacy_Click(object sender, RoutedEventArgs e) { + e.Handled = true; if (_privacyDialogShown) return; _privacyDialogShown = true; try @@ -422,15 +400,15 @@ namespace Ink_Canvas.Windows } finally { - _privacyDialogShown = false; + Dispatcher.BeginInvoke(new Action(() => _privacyDialogShown = false), + System.Windows.Threading.DispatcherPriority.Background); } } private void UpdateConfirmEnabled() { - if (BtnConfirm == null || CheckBoxPrivacyAccepted == null) return; - // 在步骤 0 时, 必须先勾选隐私协议才能继续 - BtnConfirm.IsEnabled = _currentStep != 0 || CheckBoxPrivacyAccepted.IsChecked == true; + if (BtnConfirm == null) return; + BtnConfirm.IsEnabled = true; } #endregion diff --git a/Ink Canvas/Windows/SplashScreen.xaml.cs b/Ink Canvas/Windows/SplashScreen.xaml.cs index b87a5c52..3d39ea9d 100644 --- a/Ink Canvas/Windows/SplashScreen.xaml.cs +++ b/Ink Canvas/Windows/SplashScreen.xaml.cs @@ -6,7 +6,6 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Animation; -using System.Windows.Threading; namespace Ink_Canvas.Windows { @@ -15,16 +14,7 @@ namespace Ink_Canvas.Windows /// public partial class SplashScreen : Window { - private DispatcherTimer _timer; - private int _loadingStep = 0; private int _actualSplashStyle = 1; - private readonly string[] _loadingMessages = { - "正在启动 Ink Canvas...", - "正在初始化组件...", - "正在加载配置...", - "正在准备界面...", - "启动完成!" - }; public SplashScreen() { @@ -42,33 +32,6 @@ namespace Ink_Canvas.Windows // 加载启动图片并获取实际样式 _actualSplashStyle = LoadSplashImageWithStyle(); - - // 启动加载动画 - StartLoadingAnimation(); - } - - private void StartLoadingAnimation() - { - _timer = new DispatcherTimer - { - Interval = TimeSpan.FromMilliseconds(1200) - }; - _timer.Tick += Timer_Tick; - _timer.Start(); - } - - private void Timer_Tick(object sender, EventArgs e) - { - if (_loadingStep < _loadingMessages.Length) - { - LoadingText.Text = _loadingMessages[_loadingStep]; - _loadingStep++; - } - else - { - _timer.Stop(); - // 不要自动关闭启动画面,等待外部调用CloseSplashScreen - } } public void CloseSplashScreen()