コード例 #1
0
        protected override void CloneCore(ApplicationJumpItemInfo clone)
        {
            base.CloneCore(clone);
            ApplicationJumpTaskInfo task = (ApplicationJumpTaskInfo)clone;

            task.Action            = Action;
            task.ApplicationPath   = ApplicationPath;
            task.Arguments         = Arguments;
            task.Description       = Description;
            task.Icon              = Icon;
            task.IconResourceIndex = IconResourceIndex;
            task.IconResourcePath  = IconResourcePath;
            task.Title             = Title;
            task.WorkingDirectory  = WorkingDirectory;
            if (CommandId != null && !CommandId.EndsWith(AutoGeneratedCommandSuffix, StringComparison.Ordinal))
            {
                task.CommandId = CommandId;
            }
        }
コード例 #2
0
        public static ApplicationJumpTaskInfo AddOrReplace(this IApplicationJumpList jumpList, string customCategory, string title, ImageSource icon, string description, Action action, string commandId = null)
        {
            if (jumpList == null)
            {
                throw new ArgumentNullException("jumpList");
            }
            ApplicationJumpTaskInfo jumpItem = new ApplicationJumpTaskInfo()
            {
                CustomCategory = customCategory, Title = title, Icon = icon, Description = description, CommandId = commandId, Action = action
            };

            try {
                jumpList.AddOrReplace(jumpItem);
            } catch (ApplicationJumpTaskInvalidIconException e) {
                throw new ArgumentException("", "icon", e);
            } catch (InvalidApplicationJumpItemException e) {
                throw new InvalidOperationException("", e);
            }
            return(jumpItem);
        }