private void OpenFile() { var ext = ".csv"; var filter = $"CSV file (*{ext})|*{ext}"; var(result, filename) = DialogManager.ShowOpenFileDialog("Open ", ext, filter); if (result == true) { FullFilename = filename; Books = GoodreadsImporter.Import(FullFilename).ToObservableCollection(); Shelves = Books.Select(b => b.ExclusiveShelf) .Distinct() .OrderBy(s => s) .Select(s => new ShelfViewModel(s)) .ToObservableCollection(); // Check if books have already been imported (ie. is already in the collection) Books.Apply(b => b.IsDuplicate = state_manager.CurrentCollection.IsBookInCollection(b.Title, b.ISBN, b.ISBN13)); } }