Esempio n. 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();
            }
        }
Esempio n. 2
0
 protected virtual ApplicationJumpItemInfo GetItem(int index)
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         return(designModeItems[index]);
     }
     return(ApplicationJumpItemWrapper.Unwrap(nativeJumpList[index]));
 }
Esempio n. 3
0
 protected virtual bool ContainsItem(ApplicationJumpItemInfo item)
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         return(designModeItems.Contains(item));
     }
     return(nativeJumpList.Contains(ApplicationJumpItemWrapper.Wrap(item)));
 }
Esempio n. 4
0
 protected virtual IEnumerable <ApplicationJumpItemInfo> GetItems()
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         return(designModeItems);
     }
     return(nativeJumpList.Select(i => ApplicationJumpItemWrapper.Unwrap(i)));
 }
Esempio n. 5
0
 protected virtual int ItemsCount()
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         return(designModeItems.Count);
     }
     return(nativeJumpList.Count);
 }
Esempio n. 6
0
 public virtual void AddToRecentCategory(string jumpPath)
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         return;
     }
     nativeJumpList.AddToRecentCategory(jumpPath);
 }
Esempio n. 7
0
 protected virtual int IndexOfItem(ApplicationJumpItemInfo item)
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         return(designModeItems.IndexOf(item));
     }
     return(nativeJumpList.IndexOf(ApplicationJumpItemWrapper.Wrap(item)));
 }
 bool ShouldAttachItem(T item)
 {
     if (!InteractionHelper.IsInDesignMode(AssociatedObject))
     {
         return(true);
     }
     return(!InteractionHelper.IsInDesignMode(item));
 }
Esempio n. 9
0
 protected virtual void ClearItems()
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         designModeItems.Clear();
         return;
     }
     nativeJumpList.Clear();
 }
Esempio n. 10
0
 protected virtual void RemoveItemAt(int index)
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         designModeItems.RemoveAt(index);
         return;
     }
     nativeJumpList.RemoveAt(index);
 }
Esempio n. 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));
 }
Esempio n. 12
0
 protected virtual void AddItem(ApplicationJumpItemInfo item)
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         designModeItems.Add(item);
         return;
     }
     nativeJumpList.Add(PrepareItem(item, null));
 }
Esempio n. 13
0
 protected virtual void SetItem(int index, ApplicationJumpItemInfo item)
 {
     if (InteractionHelper.IsInDesignMode(this))
     {
         designModeItems[index] = item;
         return;
     }
     nativeJumpList[index] = PrepareItem(item, nativeJumpList[index]);
 }
Esempio n. 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);
        }
Esempio n. 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;
 }
Esempio n. 16
0
 bool ShouldAttachItem(T item)
 {
     if (InteractionHelper.GetEnableBehaviorsInDesignTime(AssociatedObject))
     {
         return(true);
     }
     if (!InteractionHelper.IsInDesignMode(AssociatedObject))
     {
         return(true);
     }
     return(!InteractionHelper.IsInDesignMode(item));
 }
Esempio n. 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);
        }