Ejemplo n.º 1
0
 /// <summary>
 /// Add JumpList items for this category
 /// </summary>
 /// <param name="items">The items to add to the JumpList.</param>
 public void AddJumpListItems(params IJumpListItem[] items)
 {
     foreach (IJumpListItem item in items)
     {
         JumpListItems.Add(item);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Inserts a JumpList item at the top of the category. If the category is already full,
        /// the bottom item will be removed.
        /// </summary>
        /// <param name="item">The item to insert into the JumpList.</param>
        public void InsertJumpListItem(IJumpListItem item)
        {
            // If the item is already on the jumplist, remove it first.
            RemoveJumpListItem(item.Path);

            if (MaxItems > 0 && JumpListItems.Count >= MaxItems)
            {
                JumpListItems.Remove(JumpListItems[JumpListItems.Count - 1]);
            }

            JumpListItems.Insert(0, item);
        }
Ejemplo n.º 3
0
        public void RemoveJumpListItem(string path)
        {
            List <IJumpListItem> itemsToRemove = new List <IJumpListItem>(
                from i in JumpListItems
                where string.Equals(path, i.Path, StringComparison.OrdinalIgnoreCase)
                select i);

            // Remove matching items
            for (int i = 0; i < itemsToRemove.Count; i++)
            {
                JumpListItems.Remove(itemsToRemove[i]);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Add a JumpList item to the bottom of the category. If the category is already full,
        /// the item will not be added.
        /// </summary>
        /// <param name="item">The item to add to the JumpList.</param>
        /// <returns>true if the item was added successfully, false otherwise.</returns>
        public bool AddJumpListItem(IJumpListItem item)
        {
            // If the item is already on the jumplist, remove it first.
            RemoveJumpListItem(item.Path);

            if (MaxItems > 0 && JumpListItems.Count >= MaxItems)
            {
                return(false);
            }

            JumpListItems.Add(item);
            return(true);
        }
Ejemplo n.º 5
0
        internal void RemoveJumpListItem(string path)
        {
            List <IJumpListItem> itemsToRemove = new List <IJumpListItem>();

            // Check for items to remove
            foreach (IJumpListItem item in JumpListItems)
            {
                if (string.Compare(path, item.Path, true) == 0)
                {
                    itemsToRemove.Add(item);
                }
            }

            // Remove matching items
            for (int i = 0; i < itemsToRemove.Count; i++)
            {
                JumpListItems.Remove(itemsToRemove[i]);
            }
        }