开发者

.Net 4 JumpTask disable "Remove from this list"

I am using jumplists in .NET 4, so far I got it working fine, but I cannot make a JumpTask read only so a user cannot remove the task from the jump list. I want to remove the Pin to List and Remove from this list options. I cannot figure out how. Here is my code:

var jumpList = new JumpList();

var jumpTask = new JumpTask
    {
        ApplicationPath = Path.Combine(Utilities.AppDir, @"SevenUpdate.exe"),
        IconResourcePath = Path.Combine(Utilities.AppDir, @"SevenUpdate.Base.dll"),
        IconResourceIndex = 2,
        Title = SevenUpdate.Properties.Resources.CheckForUpdates,
        CustomCategory = SevenUpdate.Properties.Resources.Tasks,
        Arguments = "-check",
    };

jumpList.JumpItems.Add(jumpTask);

jumpTask = new JumpTask
    {
        ApplicationPath = Path.Combine(Utilities.AppDir, @"SevenUpdate.exe"),
        IconResourcePath = Path.Combine(Utilities.AppDir, @"SevenUpdate.Base.dll"),
        IconResourceIndex = 5,
        Title = SevenUpdate.Properties.Resources.RestoreHiddenUpdates,
        CustomCategory = SevenUpdate.Properties.Resources.Tasks,
        Arguments = "-hidden"
    };

jumpList.JumpItems.Add(jumpTask);

jumpTask = new JumpTask
    {
        ApplicationPath = Path.Combine(Utilities.AppDir, @"SevenUpdate.exe"),
        IconResourcePath = Path.Combine(Utilities.AppDir, @"SevenUpdate.Base.dll"),
        IconResourceIndex = 4,
        Title = SevenUpdate.Properties.Resources.ViewUpdateHistory,
        CustomCategory = SevenUpdate.Properties.Resources.Tasks,
        Arguments = "-history",
    };

jumpList.JumpIt开发者_Go百科ems.Add(jumpTask);

jumpTask = new JumpTask
    {
        ApplicationPath = Path.Combine(Utilities.AppDir, @"SevenUpdate.exe"),
        IconResourcePath = Path.Combine(Utilities.AppDir, @"SevenUpdate.Base.dll"),
        IconResourceIndex = 3,
        Title = SevenUpdate.Properties.Resources.ChangeSettings,
        CustomCategory = SevenUpdate.Properties.Resources.Tasks,
        Arguments = "-settings",
    };

jumpList.JumpItems.Add(jumpTask);

JumpList.SetJumpList(Current, jumpList);


What Kate means by Tasks don't appear to be removable is that literally items that appear in the "Tasks" category cannot be removed. If you would like to remove the ability to pin or unpin items in the JumpList do not supply a CustomCategory. This will cause the items to appear in the "Tasks" category and will be unpinnable and unremovable.


You are not supposed to do that. Pinning, unpinning, and removing are all supposed to be in the user's control.

If you would like to add certain items (like blank starting points, or templates) independent of what the user has opened recently/frequently then I suggest adding a custom category and adding the items to that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜