Click here to Skip to main content
15,887,214 members
Articles / Programming Languages / C#

Anatomy of the Windows 7 taskbar – Jumplist (Part 1)

Rate me:
Please Sign up or sign in to vote.
4.67/5 (2 votes)
1 Apr 2010CPOL 12.7K   5  
Anatomy of the Windows 7 taskbar – Jumplist (Part 1)

The last topic I want to cover about the Windows 7 taskbar is the Jumplist!!!

To create a new JumpList, call CreateJumpList():

C#
JumpList jumplist = JumpList.CreateJumpList();

We should now choose if we are only creating user tasks or custom categories? I decided to create user tasks:

C#
jumplist.AddUserTasks(new JumpListLink(Path.Combine
  (Environment.CurrentDirectory, "MiMail.exe"), "Mail") { Arguments = "mail" });
jumplist.AddUserTasks(new JumpListLink(Path.Combine
  (Environment.CurrentDirectory, "MiMail.exe"), "Contacts") { Arguments = "contacts" });
jumplist.AddUserTasks(new JumpListLink(Path.Combine
  (Environment.CurrentDirectory, "MiMail.exe"), "Calendar") { Arguments = "calendar" });

We could also use custom categories to group our tasks:

C#
JumpListCustomCategory category = new JumpListCustomCategory("Mail");
category.AddJumpListItems(new JumpListLink(Path.Combine
  (Environment.CurrentDirectory, "MiMail.exe"), "Inbox") { Arguments = "inbox" });
category.AddJumpListItems(new JumpListLink(Path.Combine
  (Environment.CurrentDirectory, "MiMail.exe"), "New Message") 
  { Arguments = "newMessage" });
jumplist.AddCustomCategories(category);

Don't forget to call Refresh():

C#
jumplist.Refresh();

Now, if you read my previous blog post and had no clue why you would want to use it? JumpList allows you to specify an application (and its arguments) to be executed if you click on a user task!!!

Cool, isn't it?

To remove all the user tasks:

C#
jumplist.ClearAllUserTasks();

User tasks is also available if the application is pinned to the taskbar (if not removed)!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
South Africa South Africa
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --