From 091c2b2135621d099b2dd7d2ac9c5aefe1c25e6c Mon Sep 17 00:00:00 2001 From: yijiy <5780033+yijiy@users.noreply.github.com> Date: Tue, 22 Sep 2026 22:30:14 -0700 Subject: [PATCH 1/2] Improve Open Data Folder launch perf --- QuickLook/TrayIconManager.cs | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/QuickLook/TrayIconManager.cs b/QuickLook/TrayIconManager.cs index ab831c930..086168105 100644 --- a/QuickLook/TrayIconManager.cs +++ b/QuickLook/TrayIconManager.cs @@ -23,6 +23,8 @@ using System.ComponentModel; using System.Diagnostics; using System.IO; +using System.Reflection; +using System.Runtime.InteropServices; using System.Windows.Forms; using Wpf.Ui.Violeta.Win32; using OSThemeHelper = QuickLook.Common.Helpers.OSThemeHelper; @@ -68,7 +70,7 @@ private TrayIconManager() new TrayMenuItem() { Header = TranslationHelper.Get("Icon_OpenDataFolder"), - Command = new RelayCommand(() => Process.Start("explorer.exe", SettingHelper.LocalDataPath)), + Command = new RelayCommand(OpenDataFolder), }, _itemAutorun = new TrayMenuItem() { @@ -117,6 +119,32 @@ public void Dispose() _icon.IsVisible = false; } + private static void OpenDataFolder() + { + var shellType = Type.GetTypeFromProgID("Shell.Application"); + if (shellType == null) + throw new InvalidOperationException("Shell.Application is unavailable."); + + var shell = Activator.CreateInstance(shellType); + if (shell == null) + throw new InvalidOperationException("Unable to create Shell.Application."); + + try + { + shellType.InvokeMember( + "Explore", + BindingFlags.InvokeMethod, + null, + shell, + [SettingHelper.LocalDataPath]); + } + finally + { + if (Marshal.IsComObject(shell)) + Marshal.FinalReleaseComObject(shell); + } + } + public void Restart(string fileName = null, string dir = null, string args = null, int? exitCode = null, bool forced = false) { _ = args; // Currently there is no cli supported by QL From 0b6e5162463503937bc084b11b8e38cc9d6cef51 Mon Sep 17 00:00:00 2001 From: yijiy <5780033+yijiy@users.noreply.github.com> Date: Wed, 23 Sep 2026 13:53:03 -0700 Subject: [PATCH 2/2] Apply code review suggestion --- QuickLook/TrayIconManager.cs | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/QuickLook/TrayIconManager.cs b/QuickLook/TrayIconManager.cs index 086168105..e07ee3b70 100644 --- a/QuickLook/TrayIconManager.cs +++ b/QuickLook/TrayIconManager.cs @@ -23,8 +23,6 @@ using System.ComponentModel; using System.Diagnostics; using System.IO; -using System.Reflection; -using System.Runtime.InteropServices; using System.Windows.Forms; using Wpf.Ui.Violeta.Win32; using OSThemeHelper = QuickLook.Common.Helpers.OSThemeHelper; @@ -70,7 +68,11 @@ private TrayIconManager() new TrayMenuItem() { Header = TranslationHelper.Get("Icon_OpenDataFolder"), - Command = new RelayCommand(OpenDataFolder), + Command = new RelayCommand(() => Process.Start(new ProcessStartInfo(SettingHelper.LocalDataPath) + { + UseShellExecute = true, + Verb = "open", + })), }, _itemAutorun = new TrayMenuItem() { @@ -119,32 +121,6 @@ public void Dispose() _icon.IsVisible = false; } - private static void OpenDataFolder() - { - var shellType = Type.GetTypeFromProgID("Shell.Application"); - if (shellType == null) - throw new InvalidOperationException("Shell.Application is unavailable."); - - var shell = Activator.CreateInstance(shellType); - if (shell == null) - throw new InvalidOperationException("Unable to create Shell.Application."); - - try - { - shellType.InvokeMember( - "Explore", - BindingFlags.InvokeMethod, - null, - shell, - [SettingHelper.LocalDataPath]); - } - finally - { - if (Marshal.IsComObject(shell)) - Marshal.FinalReleaseComObject(shell); - } - } - public void Restart(string fileName = null, string dir = null, string args = null, int? exitCode = null, bool forced = false) { _ = args; // Currently there is no cli supported by QL