async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { Items.Clear(); ItemsGrouped.Clear(); var items = await DataStoreNew.GetItemsAsync <Invoice>(); foreach (var item in items) { Items.Add(item); } foreach (var group in items.GroupBy(x => x.SellerName)) { ItemsGrouped.Add(group); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
private async Task RefreshData() { IsBusy = true; var data = await _client.GetTable <TodoItem>().ToListAsync(); foreach (var item in data) { Items.Add(item); } var sorted = from item in Items orderby item.Text group item by item.Text[0].ToString() into itemGroup select new Grouping <string, TodoItem>(itemGroup.Key, itemGroup); foreach (var item in sorted) { ItemsGrouped.Add(item); } IsBusy = false; }