You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.6 KiB
59 lines
1.6 KiB
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>((string query) =>
|
|
{
|
|
SearchResults = DataService.GetSearchResults(query);
|
|
});
|
|
|
|
private List<string> searchResults = DataService.Fruits;
|
|
public List<string> 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<Book>(books);
|
|
AuteurGroups.Add(new AuteurGroup(author.Name, observableBooks));
|
|
}*/
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
System.Diagnostics.Debug.WriteLine(ex.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|