示例#1
0
        /// <summary>
        /// Add object to recently accessed list.
        /// </summary>
        /// <param name="recent">Recent object.</param>
        public void AddToRecent(IHistoryObject recent)
        {
            if (this.recentList.Count > 0 && ReferenceEquals(this.recentList[0], recent))
            {
                return;
            }

            // Remove selection from recent history list to ensure that it is not listed
            // multiple times. Place at top of list for most recent history.
            this.recentList.Remove(recent);
            this.recentList.Insert(0, recent);

            // Limit number of entries to 10.
            if (this.recentList.Count > this.MaximumRecentCount)
            {
                this.recentList.RemoveRange(this.MaximumRecentCount, this.recentList.Count - this.MaximumRecentCount);
            }
        }
示例#2
0
 /// <summary>
 /// Initialize new <see cref="State"/> instance for a selected object.
 /// </summary>
 /// <param name="selected">Selected object.</param>
 public State(IHistoryObject selected)
 {
     this.Object = selected;
 }