コード例 #1
0
        /// <summary>
        ///     Add file name to Recent list.
        ///     Call this function when file is opened successfully.
        ///     If file already exists in the list, it is moved to the first place.
        /// </summary>
        /// <param name="fullFileName">File Name</param>
        public void Add(string fullFileName)
        {
            if (String.IsNullOrWhiteSpace(fullFileName))
            {
                return;
            }

            Remove(fullFileName);

            // if array has maximum length, remove last element
            if (RecentFilesCollection.Count == _maxNumberOfFiles)
            {
                RecentFilesCollection.RemoveAt(_maxNumberOfFiles - 1);
            }

            // add new file name to the start of array
            RecentFilesCollection.Insert(0, new RecentFile(fullFileName, GetDisplayName(fullFileName)));
        }
コード例 #2
0
 public void SetMostRecent(RecentFileEntry entry)
 {
     files.Insert(0, entry);
 }