Exemplo n.º 1
0
        public void Insert(int index, IJumpListItem jumplist_item, int image_index)
        {
            this.Items.Insert(index, jumplist_item);

            if (jumplist_item.Type == JumpListItemType.Item)
            {
                if (this.ImageResource != null)
                {
                    ((JumpListItem)jumplist_item).IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(this.ImageResource, image_index);
                }
            }

            if (this.HandleCreated)
            {
                this.JumpListControl.ClearAllUserTasks();

                foreach (IJumpListItem item in this.Items)
                {
                    this.JumpListControl.AddUserTasks(item.ToJumpListTask());
                }

                this.JumpListControl.KnownCategoryToDisplay = Microsoft.WindowsAPICodePack.Taskbar.JumpListKnownCategoryType.Neither;
                this.JumpListControl.Refresh();
            }
        }
        /// <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;
        }
Exemplo n.º 3
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);
        }
Exemplo 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);
        }
Exemplo n.º 5
0
        public void Insert(int index, IJumpListItem jumplist_item)
        {
            this.Items.Insert(index, jumplist_item);

            if (this.HandleCreated)
            {
                this.JumpListControl.ClearAllUserTasks();

                foreach (IJumpListItem item in this.Items)
                {
                    this.JumpListControl.AddUserTasks(item.ToJumpListTask());
                }

                this.JumpListControl.KnownCategoryToDisplay = Microsoft.WindowsAPICodePack.Taskbar.JumpListKnownCategoryType.Neither;
                this.JumpListControl.Refresh();
            }
        }
Exemplo n.º 6
0
        public void RemoveAt(int index)
        {
            if (this.HandleCreated)
            {
                this.JumpListControl.ClearAllUserTasks();
            }

            IJumpListItem old = this.Items[index];

            this.Items.RemoveAt(index);
            old.Release();

            if (this.HandleCreated)
            {
                foreach (IJumpListItem item in this.Items)
                {
                    this.JumpListControl.AddUserTasks(item.ToJumpListTask());
                }

                this.JumpListControl.KnownCategoryToDisplay = Microsoft.WindowsAPICodePack.Taskbar.JumpListKnownCategoryType.Neither;
                this.JumpListControl.Refresh();
            }
        }
        /// <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);
        }