|
@@ -329,10 +329,20 @@ namespace InABox.Mobile
|
|
|
#region Searching
|
|
|
|
|
|
public Func<TItem, bool> SearchPredicate { get; set; }
|
|
|
+
|
|
|
+ public Func<List<TItem>,List<TItem>> SortPredicate { get; set; }
|
|
|
|
|
|
- public ICoreRepository Search(Func<TItem, bool> predicate)
|
|
|
+ public ICoreRepository Search(Func<TItem, bool> searchpredicate, Func<List<TItem>,List<TItem>> sortpredicate)
|
|
|
{
|
|
|
- SearchPredicate = predicate;
|
|
|
+ SortPredicate = sortpredicate;
|
|
|
+ SearchPredicate = searchpredicate;
|
|
|
+ Search();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ICoreRepository Search(Func<TItem, bool> searchpredicate)
|
|
|
+ {
|
|
|
+ SearchPredicate = searchpredicate;
|
|
|
Search();
|
|
|
return this;
|
|
|
}
|
|
@@ -346,6 +356,9 @@ namespace InABox.Mobile
|
|
|
? new List<TItem>(AllItems.Where(SearchPredicate))
|
|
|
: new List<TItem>(AllItems);
|
|
|
|
|
|
+ if (SortPredicate != null)
|
|
|
+ items = SortPredicate(items);
|
|
|
+
|
|
|
SelectedItems.ReplaceRange(items.Where(x=>curselected.Contains(x)));
|
|
|
OnPropertyChanged(nameof(SelectedItems));
|
|
|
|