async Task RefreshData() { IsBusy = true; IsBusy = true; var dishes = await _db.GetDishesAsync(); Items.Clear(); foreach (var dish in dishes) { Items.Add(dish); } IsBusy = false; await Task.Delay(2000); IsBusy = false; }
public SqliteDemoPageViewModel() { var path = DependencyService.Get <IPathService>().GetDatabasePath(); _db = new SqliteDataBase(path); RefreshDataCommand = new Command( async() => await RefreshData()); AddCommand = new Command( async() => await AddData()); var t = _db.GetDishesAsync(); t.Wait(); var dishes = t.Result; Items = new ObservableCollection <Dish>(dishes); }