using Model; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Windows.Input; using ToolKit; namespace VMWrapper { public class SearchBarViewModel : BaseViewModel { private readonly ILibraryManager data; public SearchBarViewModel(ILibraryManager data) { this.data = data; } /* public ICommand PerformSearch => new Command((string query) => { SearchResults = DataService.GetSearchResults(query); }); private List searchResults = DataService.Fruits; public List SearchResults { get { return searchResults; } set { searchResults = value; NotifyPropertyChanged(); } }*/ public async void SearchAuthor(string nomSearch) { try { var (totalA, authors) = await data.GetAuthorsByName(nomSearch, 0, 5); /*foreach (Author author in authors) { var books = data.GetBooksByAuthor(author.Name, 0, 5).Result.Item2; var observableBooks = new ObservableCollection(books); AuteurGroups.Add(new AuteurGroup(author.Name, observableBooks)); }*/ } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } } } }