using System.Collections.Generic; using System.Linq; namespace mdfinder { /// A scan results model providing bindable properties. public class ScanResults : PropertyChangedAlerter { #region Members /// The duplicate files. private IEnumerable duplicateFiles; /// The selected duplicate file group. private DuplicateFileGroup selectedDuplicateFileGroup; #endregion Members #region Properties /// Gets or sets the duplicate files. /// The duplicate files. public IEnumerable DuplicateFiles { get { return this.duplicateFiles; } set { this.duplicateFiles = value; OnPropertyChanged(); } } /// Gets or sets the selected duplicate file group. /// The selected duplicate file group. public DuplicateFileGroup SelectedDuplicateFileGroup { get { return this.selectedDuplicateFileGroup; } set { this.selectedDuplicateFileGroup = value; OnPropertyChanged(); } } /// Gets the statistics string. /// The statistics string. public string Statistics { get { return string.Format("{0} Duplicates", this.duplicateFiles.Sum(df => df.Count - 1)); } } #endregion Properties #region Constructors public ScanResults() { this.duplicateFiles = Enumerable.Empty(); this.selectedDuplicateFileGroup = new DuplicateFileGroup(Enumerable.Empty()); this.AddConstantCallProperty("Statistics"); } #endregion Constructors } }