Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
        /// <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());
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
        /// <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();
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
 /// <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);
 }
Ejemplo n.º 10
0
        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);
            }
        }
Ejemplo n.º 11
0
 /// <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);
 }
Ejemplo n.º 12
0
        /// <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());
        }
Ejemplo n.º 13
0
 /// <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);
 }
Ejemplo n.º 14
0
 /// <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);
 }
Ejemplo n.º 15
0
 /// <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);
 }
Ejemplo n.º 16
0
 /// <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);
 }
Ejemplo n.º 17
0
 /// <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);
 }
Ejemplo n.º 18
0
        /// <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();
        }
Ejemplo n.º 19
0
 public void AddCustomDestination(IJumpListDestination destination)
 {
 }