コード例 #1
0
        public virtual IEnumerable <RejectedApplicationJumpItem> Apply()
        {
            if (InteractionHelper.IsInDesignMode(this))
            {
                return new RejectedApplicationJumpItem[] { }
            }
            ;
            jumpActionsManager.BeginUpdate();
            try {
                foreach (JumpItem jumpItem in nativeJumpList)
                {
                    ApplicationJumpItemWrapper.FillWrapProperties(jumpItem);
                    ApplicationJumpTaskWrap jumpTask = jumpItem as ApplicationJumpTaskWrap;
                    if (jumpTask != null)
                    {
                        jumpActionsManager.RegisterAction(jumpTask, CommandLineArgumentPrefix, GetLauncherPath);
                    }
                }
                IEnumerable <Tuple <JumpItem, JumpItemRejectionReason> > nativeRejectedItems = nativeJumpList.Apply() ?? new Tuple <JumpItem, JumpItemRejectionReason>[] { };

                return(nativeRejectedItems.Select(i => new RejectedApplicationJumpItem(ApplicationJumpItemWrapper.Unwrap(i.Item1), i.Item2)).ToArray());
            } finally {
                jumpActionsManager.EndUpdate();
            }
        }
コード例 #2
0
 protected virtual ApplicationJumpItemInfo GetItem(int index)
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         return(designModeItems[index]);
     }
     return(ApplicationJumpItemWrapper.Unwrap(nativeJumpList[index]));
 }
コード例 #3
0
 protected virtual bool ContainsItem(ApplicationJumpItemInfo item)
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         return(designModeItems.Contains(item));
     }
     return(nativeJumpList.Contains(ApplicationJumpItemWrapper.Wrap(item)));
 }
コード例 #4
0
 protected virtual IEnumerable <ApplicationJumpItemInfo> GetItems()
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         return(designModeItems);
     }
     return(nativeJumpList.Select(i => ApplicationJumpItemWrapper.Unwrap(i)));
 }
コード例 #5
0
 protected virtual int ItemsCount()
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         return(designModeItems.Count);
     }
     return(nativeJumpList.Count);
 }
コード例 #6
0
 public virtual void AddToRecentCategory(string jumpPath)
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         return;
     }
     nativeJumpList.AddToRecentCategory(jumpPath);
 }
コード例 #7
0
 protected virtual int IndexOfItem(ApplicationJumpItemInfo item)
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         return(designModeItems.IndexOf(item));
     }
     return(nativeJumpList.IndexOf(ApplicationJumpItemWrapper.Wrap(item)));
 }
コード例 #8
0
 bool ShouldAttachItem(T item)
 {
     if (!InteractionHelper.IsInDesignMode(AssociatedObject))
     {
         return(true);
     }
     return(!InteractionHelper.IsInDesignMode(item));
 }
コード例 #9
0
 protected virtual void ClearItems()
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         designModeItems.Clear();
         return;
     }
     nativeJumpList.Clear();
 }
コード例 #10
0
 protected virtual void RemoveItemAt(int index)
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         designModeItems.RemoveAt(index);
         return;
     }
     nativeJumpList.RemoveAt(index);
 }
コード例 #11
0
 protected virtual void InsertItem(int index, ApplicationJumpItemInfo item)
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         designModeItems.Insert(index, item);
         return;
     }
     nativeJumpList.Insert(index, PrepareItem(item, null));
 }
コード例 #12
0
 protected virtual void AddItem(ApplicationJumpItemInfo item)
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         designModeItems.Add(item);
         return;
     }
     nativeJumpList.Add(PrepareItem(item, null));
 }
コード例 #13
0
 protected virtual void SetItem(int index, ApplicationJumpItemInfo item)
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         designModeItems[index] = item;
         return;
     }
     nativeJumpList[index] = PrepareItem(item, nativeJumpList[index]);
 }
コード例 #14
0
        protected virtual ApplicationJumpTaskInfo Find(string commandId)
        {
            if (InteractionHelper.IsInDesignMode(this))
            {
                return(null);
            }
            ApplicationJumpTaskWrap task = (ApplicationJumpTaskWrap)nativeJumpList.Find(commandId);

            return(task == null ? null : task.ApplicationJumpTask);
        }
コード例 #15
0
 protected ApplicationJumpListService(INativeJumpList nativeJumpList, IJumpActionsManager jumpActionsManager)
 {
     IconStorage = CreateDefaultIconStorage();
     jumpList    = new ApplicationJumpList(this);
     Items       = new ApplicationJumpItemCollectionInternal(this);
     if (InteractionHelper.IsInDesignMode(this))
     {
         return;
     }
     this.nativeJumpList     = nativeJumpList ?? currentNativeJumpList;
     this.jumpActionsManager = jumpActionsManager ?? JumpActionsManager.Current;
 }
コード例 #16
0
 bool ShouldAttachItem(T item)
 {
     if (InteractionHelper.GetEnableBehaviorsInDesignTime(AssociatedObject))
     {
         return(true);
     }
     if (!InteractionHelper.IsInDesignMode(AssociatedObject))
     {
         return(true);
     }
     return(!InteractionHelper.IsInDesignMode(item));
 }
コード例 #17
0
        public virtual bool AddOrReplace(ApplicationJumpTaskInfo jumpTask)
        {
            if (InteractionHelper.IsInDesignMode(this))
            {
                designModeItems.Add(jumpTask);
                return(true);
            }
            ApplicationJumpTaskWrap jumpTaskWrap = new ApplicationJumpTaskWrap(jumpTask);

            PrepareTask(jumpTaskWrap);
            ISupportInitialize itemInit = jumpTask;

            itemInit.EndInit();
            JumpItem existingItem = nativeJumpList.Find(jumpTask.CommandId);

            if (existingItem != null)
            {
                nativeJumpList[nativeJumpList.IndexOf(existingItem)] = jumpTaskWrap;
                return(false);
            }
            nativeJumpList.Add(jumpTaskWrap);
            return(true);
        }