public void PropertiesTest()
 {
     var vm = new RecentEntry(0, string.Empty, null);
     TestsHelper.TestPublicDeclaredPropertiesGetSet(vm);
 }
Exemple #2
0
        /// <summary>
        /// Adds the specified identifier.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        public void Add(int id, string name, string description)
        {
            if (id == 0 || string.IsNullOrEmpty(name)) return;

            var item = new RecentEntry(id, name, description, this);

            var pinnedEntry = PinnedList.FirstOrDefault(i => i.Id == ((IRecentEntry)item).Id);
            if (pinnedEntry != null) return;

            var existingEntry = UnpinnedList.FirstOrDefault(i => i.Id == ((IRecentEntry)item).Id);
            if (existingEntry != null)
            {
                UnpinnedList.Remove(existingEntry);
                UnpinnedList.Insert(0, item);
            }
            else
            {
                UnpinnedList.Insert(0, item);
                if (UnpinnedList.Count + PinnedList.Count > _maxEntry)
                    UnpinnedList.Remove(UnpinnedList.Last());
            }

            Save();

        }