예제 #1
0
    private static object GetShellObjectForJumpItem(JumpItem jumpItem)
    {
        JumpPath jumpPath = jumpItem as JumpPath;
        JumpTask jumpTask = jumpItem as JumpTask;

        if (jumpPath != null)
        {
            return(JumpList.CreateItemFromJumpPath(jumpPath));
        }
        if (jumpTask != null)
        {
            return(JumpList.CreateLinkFromJumpTask(jumpTask, true));
        }
        return(null);
    }
예제 #2
0
 public static void AddToRecentCategory(JumpTask jumpTask)
 {
     Verify.IsNotNull <JumpTask>(jumpTask, "jumpTask");
     if (Utility.IsOSWindows7OrNewer)
     {
         IShellLinkW shellLinkW = JumpList.CreateLinkFromJumpTask(jumpTask, false);
         try
         {
             if (shellLinkW != null)
             {
                 NativeMethods.SHAddToRecentDocs(shellLinkW);
             }
         }
         finally
         {
             Utility.SafeRelease <IShellLinkW>(ref shellLinkW);
         }
     }
 }