This article introduces another highlight of the taskbar: The Jump list (Jump Lists, JL ). JL allows you to conveniently and quickly find the files (documents, images, audio or video) You want to browse and links or shortcuts to applications. Take the IE browser as an example to see what features JL has:
·In the Red Area "Taskbar Tasks", some default Tasks of the application are placed: "Open IE browser", "unfix from Taskbar", and "close program ". The Taskbar Tasks List, whether or not it has been developed for JL, will appear in all applications, such as previous instance programs (such ).
·"User Tasks" contains some functions provided by the application itself, through which you can directly operate on the application. For example, open a new IE label.
·The "Known Category" list is the default Category for Windows 7, which includes three modes: "Recent" (Recent browsing), "Frequent" (Frequent browsing), and "Neither ". It is the Frequent mode. Its function is to record the content of frequently browsed web pages so that they can be browsed again in the future. As time passes by, the webpage links in the list will change or disappear. In addition to the "Known Category" list, you can also create "Custom Category" (which will be discussed later ).
·"Pinned Category", as mentioned above, web pages in the "Frequent Category" list will change frequently. You can right-click a web page and "dingtalk" in the list to make it permanently saved (for example ).
Create a User Tasks list
Do you want to add a JL for your program? The following describes how to create a User Tasks list. 1. PassJumpListClass to create an JL instance. 2. UseJumpListLink(String pathValue, string titleValue) method (pathValue: Application Path, titleValue: Link name), you can "Notepad", "artboard" such Windows applications, and create the "website address" as the User Tasks link. 3. Use againAddUserTasks(Params IJumpListTask [] tasks) method to add these links to JL. The following code is used:
private JumpList jumpList;
private string systemPath = Environment.GetFolderPath(Environment.SpecialFolder.System);private void addApps_Click(object sender, RoutedEventArgs e){ IJumpListTask notepadTask = new JumpListLink(Path.Combine(systemPath, "notepad.exe"), "Notepad") { IconReference = new IconReference(Path.Combine(systemPath, "notepad.exe"), 0) }; IJumpListTask paintTask = new JumpListLink(Path.Combine(systemPath, "mspaint.exe"), "Paint") { IconReference = new IconReference(Path.Combine(systemPath, "mspaint.exe"), 0) }; IJumpListTask jlSeparator = new JumpListSeparator(); IJumpListTask linkTask = new JumpListLink("http://gnielee.cnblogs.com", "Gnie's Blog") { IconReference = new IconReference("C:\\Program Files\\Internet Explorer\\iexplore.exe", 0) }; jumpList.AddUserTasks(notepadTask, paintTask, jlSeparator, linkTask); jumpList.Refresh();}
In the above programIJumpListTaskThe interface creates a "program Link "(JumpListLink, Where IconReference is the link icon) and "split line "(JumpListSeparator); When using the AddUserTasks method, pay attention to the location relationship of each link. Finally, you must use the Refresh method to Refresh JL to display the latest JL content (as shown below ).
Create a Known Category list
Before using the Known Category function, you must first register the file type for the program.KnownCategoryToDisplayAttribute Sets Known Category to any type in "Recent", "Frequent", and "Neither". When a test program opens a file, the corresponding file link is displayed in the Known Category list. The following code is used:
if (!Utilities.IsApplicationRegistered(TaskbarManager.Instance.ApplicationId)){ Utilities.RegisterFileAssociations(TaskbarManager.Instance.ApplicationId, false, TaskbarManager.Instance.ApplicationId, Assembly.GetExecutingAssembly().Location, ".jpg", ".png", ".gif", ".JPG", ".PNG", ".GIF");}jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;CommonOpenFileDialog cfd = new CommonOpenFileDialog();cfd.ShowDialog();jumpList.Refresh();
The JL effect after the demo.png file is opened:
JumpListKnownCategoryTypeThree types of Known Category are defined in enumeration: "Neither", "Recent", and "Frequent ".KnownCategoryOrdinalPositionAttribute can be used to modify the position of the Known Category in JL:
switch (this.knownCategory.SelectionBoxItem.ToString()){ case "None": jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Neither; break; case "Recent": jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent; break; case "Frequent": jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Frequent; break;}jumpList.KnownCategoryOrdinalPosition = Convert.ToInt32(this.categoryPostion.SelectionBoxItem.ToString());jumpList.Refresh();
Effect after modifying Recent to Frequent:
Create a Custom Category list
As in the previous method of creating a JumpList, 1. Create a "Custom category" list instance through the jumplistmcmcategory class. 2.JumpListCustomCategory(String categoryName) method is used to name the list. 3. UseAddJumpListItemsMethod to add the link to the category. The following code is used:
private JumpListCustomCategory customCategory;private void addCus_Click(object sender, RoutedEventArgs e){ if (this.categoryName.Text.Length > 0) { customCategory = new JumpListCustomCategory(this.categoryName.Text); jumpList.AddCustomCategories(customCategory); JumpListLink jlItem = new JumpListLink(Assembly.GetExecutingAssembly().Location, this.categoryName.Text + ".png") { IconReference = new IconReference(Assembly.GetEntryAssembly().Location, 0) }; customCategory.AddJumpListItems(jlItem); jumpList.Refresh(); }}
KnownCategoryOrdinalPosition
In the above Code, IconReference is taken from the Icon attribute of the application, provided that the Icon resource needs to be set for the application property (as shown in ). Now, all related development of the taskbar has been completed in Windows 7, and we hope this series will help you.
Index of series articles
· Overlay Icon for Windows 7 taskbar Development)
· Progress Bar for Windows 7 taskbar Development (Progress Bar)
· Thumbnail preview for Windows 7 taskbar Development (Thumbnail)
· Thumbnail Toolbar for Windows 7 taskbar Development (Thumbnail Toolbar)
References
1. Jump into the Windows 7 Taskbar Jump Lists
Http://channel9.msdn.com/posts/yochay/Jump-into-the-Windows-7-Taskbar-Jump-Lists/
2. Windows 7 Jump Lists
Http://blogs.msdn.com/coding4fun/archive/2009/12/09/9933039.aspx
3. IconReference-Using own icons
Http://dennisdel.com /? P = 38
Download complete source code