示例#1
0
        async Task LoadDataAsync()
        {
            try {
                IsBusy = true;

                var items = await FoodManager.GetAsync();

                var favorites = await FavoriteManager.GetAsync();

                var fooditems = from fi in items
                                join fav in favorites on fi.Id equals fav.FoodItemId
                                select fi;

                FoodItems.Clear();

                foreach (var item in fooditems)
                {
                    FoodItems.Add(new FoodViewModel(item));
                }
            } finally {
                IsBusy = false;
            }
        }
示例#2
0
 public async void LoadFoodItems()
 {
     IsBusy    = true;
     FoodItems = new ObservableCollection <Food>(await manager.GetAsync());
     IsBusy    = false;
 }