【发布时间】:2011-06-02 03:13:02
【问题描述】:
我正在尝试在我的 C# 应用程序中使用最近和频繁跳转列表。我正在使用 Windows API Codepack v1.1 (http://code.msdn.microsoft.com/WindowsAPICodePack)。每次应用程序启动时我都会初始化 JumpLists,每次在应用程序中打开项目时,我都会向 JumpList 添加Recent()。
有些东西丢失了,因为当您右键单击任务栏中的应用程序图标时,JumpLists 根本没有显示。我有一个文件要显示一次,仅此而已!
初始化:
private void InitializeJumpLists()
{
if (TaskbarManager.IsPlatformSupported)
{
JumpList recentJumpList = null;
JumpList frequentJumpList = null;
TaskbarManager.Instance.ApplicationId = Application.ProductName;
recentJumpList = JumpList.CreateJumpList();
recentJumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;
recentJumpList.Refresh();
frequentJumpList = JumpList.CreateJumpList();
frequentJumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Frequent;
frequentJumpList.Refresh();
}
}
打开项目:
private void OpenProject(string path, bool isFromRecentFilesList)
{
DialogResult result = ConfirmProjectClosing();
if (result == DialogResult.Yes)
Save();
else if (result == DialogResult.Cancel)
return;
using (new Wait())
{
//Code here opens the project, etc.
//Try to add the file to the Jump List.
if (TaskbarManager.IsPlatformSupported)
JumpList.AddToRecent(path);
//Code here finished up.
}
}
我错过了什么?
【问题讨论】: