1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-30 23:16:09 +00:00

Correctif

This commit is contained in:
Yan Maniez 2018-07-15 23:09:04 +02:00
parent 341b0eb4dc
commit cd106acb13

View file

@ -17,7 +17,13 @@ namespace AideDeJeu.ViewModels
public ItemsViewModel() public ItemsViewModel()
{ {
LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommandAsync().ConfigureAwait(false)); LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommandAsync().ConfigureAwait(false));
SearchCommand = new Command<string>((text) => Filter.SearchText = text ); SearchCommand = new Command<string>((text) =>
{
if (Filter != null)
{
Filter.SearchText = text;
}
});
} }
public Command<string> SearchCommand { get; private set; } public Command<string> SearchCommand { get; private set; }
public ICommand LoadItemsCommand { get; protected set; } public ICommand LoadItemsCommand { get; protected set; }
@ -79,7 +85,10 @@ namespace AideDeJeu.ViewModels
{ {
Title = _AllItems.Name; Title = _AllItems.Name;
Filter = _AllItems.GetNewFilterViewModel(); Filter = _AllItems.GetNewFilterViewModel();
Filter.LoadItemsCommand = LoadItemsCommand; if (Filter != null)
{
Filter.LoadItemsCommand = LoadItemsCommand;
}
} }
} }
} }
@ -90,8 +99,15 @@ namespace AideDeJeu.ViewModels
Main.IsLoading = true; Main.IsLoading = true;
try try
{ {
var items = await Filter.FilterItems(AllItems, cancellationToken: cancellationToken); if (Filter != null)
Items = items.ToList(); {
var items = await Filter.FilterItems(AllItems, cancellationToken: cancellationToken);
Items = items.ToList();
}
else
{
Items = AllItems.ToList();
}
} }
catch (OperationCanceledException ex) catch (OperationCanceledException ex)
{ {