In this article, we begin to introduce another highlight of the taskbar: Jump Lists (hereinafter referred to as JL). JL allows users to quickly and easily find the files (documents, images, audio or video, etc.) and links or shortcuts to the application. 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", "Unpin from the taskbar", "Close the program". Regardless of whether you have developed a "Taskbar Tasks" list for JL, it will appear in all applications, such as the previous instance program (as shown below).
· “User Tasks” contains some of the features provided by the application itself, through which you can directly manipulate the application. For example, open a new IE tag.
· “Known Category” This list is the Windows 7 default category and contains three modes: “Recent”, “Frequent”, “Neither”. The following picture shows the Frequent mode. Its function is to record the content of the frequently viewed webpage so that it can be browsed again in the future. As time goes by, the webpage link in the list will change or disappear. In addition to the "Known Category" list, you also create a "Custom Category" (more on this later).
· “Pinned Category” As mentioned above, the pages in the “Frequent Category” list will change frequently. You can make it permanent by right-clicking the page in the list (as shown below).
Create a User Tasks List
Now I want to add a JL to my program. Let's first introduce how to create a User Tasks list. 1. Create a JL instance from the JumpList class. 2. Use the JumpListLink(string pathValue, string titleValue) method (pathValue: application path, titleValue: link name) to create Windows applications such as "Notepad" and "Artboard" and "Website Address" as User Tasks. link. 3. Add these links to the JL using the AddUserTasks(params IJumpListTask[] tasks) method. The following code shows:
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 program, "program link" (JumpListLink, where IconReference is the link icon) and "JumpListSeparator" are created through the IJumpListTask interface; use AddUserTasks Pay attention to the positional relationship of each link; you must use the Refresh method to refresh the JL to display the latest JL content (the following effect diagram).
Creating a Known Category List
Before using the Known Category feature, you need to register the file type for the program. Then you can preset the Known Category to "Recent" via the KnownCategoryToDisplay property. ", "Frequent", "Neither", when the test program opens a file, the corresponding file link will be displayed in the Known Category list. The following code shows:
if (!UtilitIEs.IsApplicationRegistered(TaskbarManager.Instance.ApplicationId))
{
UtilitIEs.RegisterFileAssociations(TaskbarManager.Instance.ApplicationId, false,
TaskbarManager.Instance .ApplicationId, Assembly.GetExecutingAssembly().Location,
".jpg", ".png", ".gif", ".JPG", ".PNG", ".GIF");
} < BR>jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;
CommonOpenFileDialog cfd = new CommonOpenFileDialog();
cfd.ShowDialog();
jumpList.Refresh();
Open the demo.png file Post-JL effects:
The JumpListKnownCategoryType enumeration defines three types of Known Category: "Neither", "Recent", "Frequent", and can also be modified by the KnownCategoryOrdinalPosition property. Category in JL:
switch (this.knownCategory.SelectionBoxItem.ToString())
{
case "None":
jumpL ist.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();
The effect of modifying Recent to Frequent:
Creating a Custom Category list
Like the way the JumpList was created above, 1. Creating a custom by using the JumpListCustomCategory class Classification" list instance. 2. Name the list by the JumpListCustomCategory(string categoryName) method. 3. Add the link to the category using the AddJumpListItems method. The following code shows:
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 effect
IconReference in the above code From the application's own Icon property, provided that you need to set an icon for it in the application properties. (As shown below). At this point, the development of the taskbar in Windows 7 has been completed, I hope this series is helpful to everyone.
Friends who have used Win7 system should know that the power of Win7 is sometimes some small functio
on the Win 7 desktop. When the computer is not used for a long time, we usually let it stand by. At
The Hibernate button was not found when using Win7 recently. Searched for the hel
In win7, some programs need to be run as an administrator, but we run these programs almost
How to play a rookie streamline Share six steps to make Windows 7 slimming (2)
Win7 taskbar is shy. Taskbar adds love graphic tutorial
How to modify the taskbar color in win7? Modify the taskbar and window color tutorial
Microsoft Windows7 Internet Video FAQ (1)
Win7 boot startup items how to set the computer boot startup items where to set
W7 LAN steps on how to set up file sharing
Teach you how to get Windows XP with Windows 7 Start Menu Tips
The time in the Win7 taskbar shows the day of the week and date
The unknown Win7 operating system permissions
Master must know the 70 basic skills of Windows 7 (2)
Solve Win7 can not enter sleep mode after installing SP1
Case analysis of the black screen after the win7 system is booted to the desktop
The latest version of Office Web App online access tips
Win8 virtual wifi mobile phone connected but can not access the Internet how to do
Win7 system how to operate through passwords Voice operation Win7 system graphic tutorial
What is the file in XPS format under vista system?
Eight tips to get IE8 browser running acceleration
Win7 system turns off hardware acceleration method
How to get cntv online video files under Win8 system
Windows 7 desktop software icon shows anomalous solutions
Win8.1 Update can not update properly repair program
How to prevent Windows10 software is automatically installed in