/// <summary> /// Deletes the specified application destination from the application's /// jump list. /// </summary> /// <param name="destination">The application destination.</param> public void DeleteApplicationDestination(IJumpListDestination destination) { IApplicationDestinations destinations = (IApplicationDestinations) new CApplicationDestinations(); if (!String.IsNullOrEmpty(_appId)) { destinations.SetAppID(_appId); } destinations.RemoveDestination(destination.GetShellRepresentation()); }
/// <summary> /// Deletes the specified application destination from the application's /// jump list. /// </summary> /// <param name="destination">The application destination.</param> public void DeleteApplicationDestination(IJumpListDestination destination) { IApplicationDestinations destinations = (IApplicationDestinations) new CApplicationDestinations(); if (!String.IsNullOrEmpty(_appId)) { HResult setAppIDResult = destinations.SetAppID(_appId); setAppIDResult.ThrowIf(); } HResult removeDestinationResult = destinations.RemoveDestination(destination.GetShellRepresentation()); removeDestinationResult.ThrowIf(); }
/// <summary> /// Adds the specified destination to the application's /// recent destinations list. /// </summary> /// <remarks> /// If the recent and frequent categories are disabled, /// this method has no visual effect on the jump list /// in the recent and frequent categories respectively. /// </remarks> /// <param name="destination">An object implementing /// <see cref="IJumpListDestination"/> such as <see cref="ShellLink"/> /// or <see cref="ShellItem"/>.</param> public void AddToRecent(IJumpListDestination destination) { if (destination is ShellItem) { SHARDAPPIDINFO info = new SHARDAPPIDINFO { psi = (VistaBridgeInterop.IShellItem)destination.GetShellRepresentation(), pszAppID = _appId }; UnsafeNativeMethods.SHAddToRecentDocs(ref info); } else if (destination is ShellLink) { //TODO: This doesn't actually work SHARDAPPIDINFOLINK info = new SHARDAPPIDINFOLINK { psl = (IShellLinkW)destination.GetShellRepresentation(), pszAppID = _appId }; UnsafeNativeMethods.SHAddToRecentDocs(ref info); } Thread.Sleep(200); }
/// <summary> /// Deletes the specified application destination from the application's /// jump list. /// </summary> /// <param name="destination">The application destination.</param> public void DeleteApplicationDestination(IJumpListDestination destination) { IApplicationDestinations destinations = (IApplicationDestinations)new CApplicationDestinations(); if (!String.IsNullOrEmpty(_appId)) { HResult setAppIDResult = destinations.SetAppID(_appId); setAppIDResult.ThrowIf(); } HResult removeDestinationResult = destinations.RemoveDestination(destination.GetShellRepresentation()); removeDestinationResult.ThrowIf(); }