Esempio n. 1
0
 /// <summary>
 /// 删除指定的最近文件.
 /// </summary>
 /// <param name="recentFile">最近要删除的文件.</param>
 /// <exception cref="ArgumentNullException">最近文件参数不能为空.</exception>
 /// <exception cref="ArgumentException">参数recentFile在最近文件列表中没有找到.</exception>
 public void Remove(RecentFile recentFile)
 {
     if (recentFile == null)
     {
         throw new ArgumentNullException("recentFile");
     }
     if (_recentFiles.Remove(recentFile))
     {
         recentFile.PropertyChanged -= RecentFilePropertyChanged;
     }
     else
     {
         throw new ArgumentException("The passed recentFile was not found in the recent files list.");
     }
 }
Esempio n. 2
0
        void IXmlSerializable.ReadXml(XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            reader.ReadToDescendant("RecentFile");
            while (reader.MoveToContent() == XmlNodeType.Element && reader.LocalName == "RecentFile")
            {
                var recentFile = new RecentFile();
                ((IXmlSerializable)recentFile).ReadXml(reader);
                Add(recentFile);
            }
            if (!reader.IsEmptyElement)
            {
                reader.ReadEndElement();
            }
        }
Esempio n. 3
0
 private void Add(RecentFile recentFile)
 {
     recentFile.PropertyChanged += RecentFilePropertyChanged;
     _recentFiles.Add(recentFile);
 }
Esempio n. 4
0
 private void Insert(int index, RecentFile recentFile)
 {
     recentFile.PropertyChanged += RecentFilePropertyChanged;
     _recentFiles.Insert(index, recentFile);
 }