Improve CLI performance #1706 #1731

This commit is contained in:
ema
2025-08-03 22:20:35 +08:00
parent 2e941f468e
commit da0033b52a
2 changed files with 9 additions and 9 deletions

View File

@@ -210,27 +210,24 @@ public partial class App : Application
} }
}; };
// Initialize MessageBox patching
bool modernMessageBox = SettingHelper.Get("ModernMessageBox", true, "QuickLook");
if (modernMessageBox) MessageBoxPatcher.Initialize();
// Set initial theme based on system settings // Set initial theme based on system settings
ThemeManager.Apply(OSThemeHelper.AppsUseDarkTheme() ? ApplicationTheme.Dark : ApplicationTheme.Light); ThemeManager.Apply(OSThemeHelper.AppsUseDarkTheme() ? ApplicationTheme.Dark : ApplicationTheme.Light);
SystemEvents.UserPreferenceChanged += (_, _) => SystemEvents.UserPreferenceChanged += (_, _) =>
ThemeManager.Apply(OSThemeHelper.AppsUseDarkTheme() ? ApplicationTheme.Dark : ApplicationTheme.Light); ThemeManager.Apply(OSThemeHelper.AppsUseDarkTheme() ? ApplicationTheme.Dark : ApplicationTheme.Light);
UxTheme.ApplyPreferredAppMode(); UxTheme.ApplyPreferredAppMode();
// Initialize TrayIcon
_ = TrayIconManager.GetInstance();
base.OnStartup(e); base.OnStartup(e);
// Initialize MessageBox patching
bool modernMessageBox = SettingHelper.Get("ModernMessageBox", true, "QuickLook");
if (modernMessageBox) MessageBoxPatcher.Initialize();
} }
private void Application_Startup(object sender, StartupEventArgs e) private void Application_Startup(object sender, StartupEventArgs e)
{ {
if (!EnsureOSVersion() if (!EnsureOSVersion()
|| !EnsureFirstInstance(e.Args) || !EnsureFirstInstance(e.Args)
|| !EnsureFolderWritable(SettingHelper.LocalDataPath)) || !EnsureFolderWritable(SettingHelper.LocalDataPath))
{ {
_cleanExit = false; _cleanExit = false;
Shutdown(); Shutdown();
@@ -325,8 +322,10 @@ public partial class App : Application
} }
// Second instance: duplicate // Second instance: duplicate
else else
{
MessageBox.Show(TranslationHelper.Get("APP_SECOND_TEXT"), TranslationHelper.Get("APP_SECOND"), MessageBox.Show(TranslationHelper.Get("APP_SECOND_TEXT"), TranslationHelper.Get("APP_SECOND"),
MessageBoxButton.OK, MessageBoxImage.Information); MessageBoxButton.OK, MessageBoxImage.Information);
}
return false; return false;
} }

1
QuickLook/GlobalUsing.cs Normal file
View File

@@ -0,0 +1 @@
global using MessageBox = Wpf.Ui.Violeta.Controls.MessageBox;