public void AddDestination(IJumpListDestination destination) { List <IJumpListDestination> destinations = null; foreach (var list in _categorizedDestinations.Values) { if (list[0].Category == destination.Category) { destinations = list; break; } } if (destinations == null) { destinations = new List <IJumpListDestination>(); int last = 0; foreach (var k in _categorizedDestinations.Keys) { last = k; } _categorizedDestinations.Add( last + 1, destinations); } destinations.Add(destination); }
/// <summary> /// Adds a custom destination to the application's jump list. /// </summary> /// <param name="destination">An object implementing /// <see cref="IJumpListDestination"/> such as <see cref="ShellLink"/> /// or <see cref="ShellItem"/>.</param> public void AddCustomDestination(IJumpListDestination destination) { // Do not use CustomDestinations as they will cause an // System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) // error when the user has recent document tracking disabled Via the Group Policy setting: //“Do not keep history of recently opened documents”. or via the Users setting: //“Store and display recently opened items in the Start menu and the taskbar” in the Start menu property dialog. //_destinations.AddDestination(destination); }
public void DeleteDestination(IJumpListDestination destination) { List<IJumpListDestination> destinations = _categorizedDestinations.Values.First( list => list.First().Category == destination.Category); IJumpListDestination toDelete = destinations.Find( d => d.Path == destination.Path && d.Category == destination.Category && d.Title == destination.Title); if (toDelete != null) destinations.Remove(toDelete); }
/// <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()); }
public void DeleteDestination(IJumpListDestination destination) { List <IJumpListDestination> destinations = _categorizedDestinations.Values.First( list => list.First().Category == destination.Category); IJumpListDestination toDelete = destinations.Find( d => d.Path == destination.Path && d.Category == destination.Category && d.Title == destination.Title); if (toDelete != null) { destinations.Remove(toDelete); } }
/// <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(); }
public void AddDestination(IJumpListDestination destination) { List<IJumpListDestination> destinations = _categorizedDestinations.Values.FirstOrDefault( list => list.First().Category == destination.Category); if (destinations == null) { destinations = new List<IJumpListDestination>(); _categorizedDestinations.Add( _categorizedDestinations.Keys.LastOrDefault() + 1, destinations); } destinations.Add(destination); }
public void AddDestination(IJumpListDestination destination) { List <IJumpListDestination> destinations = _categorizedDestinations.Values.FirstOrDefault( list => list.First().Category == destination.Category); if (destinations == null) { destinations = new List <IJumpListDestination>(); _categorizedDestinations.Add( _categorizedDestinations.Keys.LastOrDefault() + 1, destinations); } destinations.Add(destination); }
/// <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); }
public void DeleteDestination(IJumpListDestination destination) { List <IJumpListDestination> destinations = null; foreach (var list in _categorizedDestinations.Values) { if (list[0].Category == destination.Category) { destinations = list; break; } } if (destination == null) { throw new Exception(); } IJumpListDestination toDelete = destinations.Find( d => d.Path == destination.Path && d.Category == destination.Category && d.Title == destination.Title); if (toDelete != null) { destinations.Remove(toDelete); } }
/// <summary> /// Deletes the specified custom destination from the application's /// jump list. /// </summary> /// <param name="destination">The destination to delete.</param> public void DeleteCustomDestination(IJumpListDestination destination) { _destinations.DeleteDestination(destination); }
/// <summary> /// Adds a custom destination to the application's jump list. /// </summary> /// <param name="destination">An object implementing /// <see cref="IJumpListDestination"/> such as <see cref="ShellLink"/> /// or <see cref="ShellItem"/>.</param> public void AddCustomDestination(IJumpListDestination destination) { _destinations.AddDestination(destination); }
/// <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(); }
public void AddCustomDestination(IJumpListDestination destination) { }