public Start(Wizard sb) { InitializeComponent(); _scanBase = sb; DataContext = _scanBase.Options; // Get drives that are checked var drivesChecked = _scanBase.Options.Drives.Where(includeDrive => includeDrive.IsChecked.GetValueOrDefault()).ToList(); // Clear drives _scanBase.Options.Drives.Clear(); try { _scanBase.Options.Drives.AddRange(DriveInfo.GetDrives() .Select(di => new IncludeDrive(di)) // Iterate through drives and check drive if checked in previous list .Select( includeDriveToAdd => new IncludeDrive { IsChecked = drivesChecked.Contains(includeDriveToAdd), Name = includeDriveToAdd.Name })); } catch (UnauthorizedAccessException ex) { Debug.WriteLine("The following error occurred: {0}\nUnable to get list of drives.", ex.Message); } // Only include directories that exist if (_scanBase.Options.IncFolders.Count > 0) { _scanBase.Options.IncFolders = new ObservableCollection <IncludeFolder>( _scanBase.Options.IncFolders.Where(includeFolder => Directory.Exists(includeFolder.Name))); } _scanBase.Options.SkipTempFiles = true; _scanBase.Options.SkipSysAppDirs = true; _scanBase.Options.SkipWindowsDir = true; _scanBase.Options.OnPropertyChanged(nameof(_scanBase.Options.SkipFilesGreaterThan)); _scanBase.Options.OnPropertyChanged(nameof(_scanBase.Options.SkipFilesGreaterSize)); _scanBase.Options.OnPropertyChanged(nameof(_scanBase.Options.SkipFilesGreaterUnit)); _scanBase.Options.HashAlgorithms = HashAlgorithm.CreateList(); _scanBase.Options.HashAlgorithm = _scanBase.Options.HashAlgorithms[2]; // SHA1 }