private void SelectImageForBook(BookRead book) { ImageSelectionWindowViewModel selectionViewModel = new ImageSelectionWindowViewModel { SearchTerm = $"{book.Author} {book.Title} amazon" }; ImageSelectionWindowView imageSelectDialog = new ImageSelectionWindowView(selectionViewModel); imageSelectDialog.ShowDialog(); if (selectionViewModel.DialogResult.HasValue && selectionViewModel.DialogResult.Value) { book.ImageUrl = selectionViewModel.SelectedImageAddress; OnPropertyChanged(() => BookImageSource); } }
/// <summary> /// The set editor to update command action. /// </summary> public void SelectImageCommandAction() { GeographyProvider geographyProvider; BooksReadProvider booksReadProvider; if (GetProviders(out geographyProvider, out booksReadProvider)) { _imageSelectionWindow = new ImageSelectionWindowViewModel { SearchTerm = InitialImageSearchTerm }; ImageSelectionWindowView imageSelectDialog = new ImageSelectionWindowView(_imageSelectionWindow); imageSelectDialog.ShowDialog(); if (_imageSelectionWindow.DialogResult.HasValue && _imageSelectionWindow.DialogResult.Value) { // update the selected image.... } OnPropertyChanged(() => BookEditor); } }