Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion QuickLook/TrayIconManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
{
Expand Down Expand Up @@ -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);
}
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Resolved
}

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
Expand Down