/// <summary> /// Executes the push pin. /// </summary> /// <param name="entry">The entry.</param> private void ExecutePushPin(IRecentEntry entry) { if (entry.IsPinned) ProcessBuilderRecentEntries.UnPushPin(entry); else ProcessBuilderRecentEntries.PushPin(entry); }
/// <summary> /// Opens the process. /// </summary> /// <param name="o">The o.</param> private void OpenProcess(IRecentEntry o) { this.ProcessEditVM.Value.ShowSelected(o.Id, true); }
/// <summary> /// Creates the element. /// </summary> /// <param name="item">The item.</param> /// <returns>XElement.</returns> /// <exception cref="System.ArgumentNullException"></exception> private static XElement CreateElement(IRecentEntry item) { if (item != null && item.Name != null) return new XElement(_entry, new XAttribute(_id, item.Id), new XAttribute(_name, item.Name), new XAttribute(_description, item.Description)); throw new ArgumentNullException(); }
/// <summary> /// Removes the specified list. /// </summary> /// <param name="list">The list.</param> /// <param name="entry">The entry.</param> private void Remove(IList<IRecentEntry> list, IRecentEntry entry) { var item = list.FirstOrDefault(i => i.Id == entry.Id); if (item != null) list.Remove(item); }
/// <summary> /// Determines whether [contains] [the specified list]. /// </summary> /// <param name="list">The list.</param> /// <param name="entry">The entry.</param> /// <returns><c>true</c> if [contains] [the specified list]; otherwise, <c>false</c>.</returns> private bool Contains(IEnumerable<IRecentEntry> list, IRecentEntry entry) { return list.Any(i => i.Id == entry.Id); }
/// <summary> /// Uns the push pin. /// </summary> /// <param name="entry">The entry.</param> public void UnPushPin(IRecentEntry entry) { if (Contains(PinnedList, entry)) Remove(PinnedList, entry); if (!Contains(UnpinnedList, entry)) UnpinnedList.Add(entry); Save(); }