private void SetUpJumpListOnNavComplete() {
var pidl = IntPtr.Zero;
try {
pidl = this._ShellListView.CurrentFolder.AbsolutePidl;
var sfi = new SHFILEINFO();
if (pidl != IntPtr.Zero && !_ShellListView.CurrentFolder.IsFileSystem) {
var res = BExplorer.Shell.Interop.Shell32.SHGetFileInfo(pidl, 0, out sfi, Marshal.SizeOf(sfi), SHGFI.IconLocation | SHGFI.SmallIcon | SHGFI.PIDL);
}
if (_ShellListView.CurrentFolder.IsFileSystem) {
BExplorer.Shell.Interop.Shell32.SHGetFileInfo(Marshal.StringToHGlobalAuto(_ShellListView.CurrentFolder.ParsingName), 0, out sfi, Marshal.SizeOf(sfi), SHGFI.IconLocation | SHGFI.SmallIcon);
}
JumpList.AddToRecentCategory(new JumpTask() {
ApplicationPath = Process.GetCurrentProcess().MainModule.FileName,
Arguments = "\"" + _ShellListView.CurrentFolder.ParsingName + "\"",
Title = _ShellListView.CurrentFolder.DisplayName,
IconResourcePath = sfi.szDisplayName,
IconResourceIndex = sfi.iIcon
});
AppJL.Apply();
} finally {
if (pidl != IntPtr.Zero) Marshal.FreeCoTaskMem(pidl);
}
}