async Task ExecuteRefreshCommand() { if (IsBusy) { return; } IsBusy = true; try { var _items = await table.GetItemsAsync(); Items.Clear(); foreach (var item in _items) { Items.Add(item); } IsBusy = false; } catch (Exception ex) { await Application.Current.MainPage.DisplayAlert("Error", ex.Message, "OK"); } }
public static async Task <IEnumerable <T> > WhereAsync <T>( this ITableDataStore <T> store, Func <T, bool> predicate) where T : EntityData { var items = await store.GetItemsAsync().ConfigureAwait(false); return(items.Where(predicate)); }
public override async void ViewDidLoad() { base.ViewDidLoad(); client = new EasyMobileServiceClient(); client.Initialize("http://xamarin-todo-sample.azurewebsites.net"); client.RegisterTable<ToDo>(); client.FinalizeSchema(); dataStore = client.Table<ToDo>(); await dataStore.Sync(); items = await dataStore.GetItemsAsync(); }
public override async void ViewDidLoad() { base.ViewDidLoad(); client = new EasyMobileServiceClient(); client.Initialize("http://xamarin-todo-sample.azurewebsites.net"); client.RegisterTable <ToDo>(); client.FinalizeSchema(); dataStore = client.Table <ToDo>(); await dataStore.Sync(); items = await dataStore.GetItemsAsync(); }
private async Task ExecuteRefreshCommand() { if (IsBusy) { return; } IsBusy = true; Exception exceptionToDisplay = null; try { var cancellationToken = _cancellationTokenSource.Token; var items = await _table.GetItemsAsync().ConfigureAwait(true); if (!cancellationToken.IsCancellationRequested) { Items.Clear(); foreach (var item in items) { Items.Add(item); } } } catch (OperationCanceledException) { } catch (Exception ex) { exceptionToDisplay = ex; } finally { IsBusy = false; } if (exceptionToDisplay != null) { await Application.Current.MainPage.DisplayAlert("Error", exceptionToDisplay.Message, "OK"); } }
async Task GetSpeakers() { if (IsBusy) { return; } Exception error = null; try { IsBusy = true; var items = await table.GetItemsAsync(); Speakers.Clear(); foreach (var item in items) { Speakers.Add(item); } } catch (Exception ex) { Debug.WriteLine("Error: " + ex); error = ex; } finally { IsBusy = false; } if (error != null) { await Application.Current.MainPage.DisplayAlert("Error!", error.Message, "OK"); } }
public Task <IEnumerable <Coffee> > GetCoffees() => table.GetItemsAsync();
public Task <IEnumerable <Cache> > GetCaches() => cacheTable.GetItemsAsync();