//public async Task<Store> UpdateStoreAsync(Store store) //{ // if (!initialized) // await Init(); // await storeTable.UpdateAsync(store); // await SyncStoresAsync(); // await MobileService.SyncContext.PushAsync(); // return store; //} public async Task <CommonYelpClass> UpdateStoreAsync(CommonYelpClass store) { if (!initialized) { await Init(); } await storeTable.UpdateAsync(store); await SyncStoresAsync(); await MobileService.SyncContext.PushAsync(); return(store); }
//public async Task<bool> RemoveStoreAsync(Store store) //{ // if (!initialized) // await Init(); // await storeTable.DeleteAsync(store); // await SyncStoresAsync(); // await MobileService.SyncContext.PushAsync(); // return true; //} public async Task <bool> RemoveStoreAsync(CommonYelpClass store) { if (!initialized) { await Init(); } await storeTable.DeleteAsync(store); await SyncStoresAsync(); await MobileService.SyncContext.PushAsync(); return(true); }
// public StorePage(Store store) public StorePage(CommonYelpClass store) { InitializeComponent(); BindingContext = viewModel = new StoreViewModel(store, this); if (Device.RuntimePlatform != Device.UWP) { MyMap = new Map { IsShowingUser = false, MapType = MapType.Hybrid }; MainGrid.Children.Add(MyMap); // Grid.SetRow(MyMap, 14); Grid.SetRow(MyMap, 6); Grid.SetColumnSpan(MyMap, 3); } }
// public async Task DeleteStore(Store store) public async Task DeleteStore(CommonYelpClass store) { if (IsBusy) { return; } IsBusy = true; try { await dataStore.RemoveStoreAsync(store); Stores.Remove(store); Sort(); } catch (Exception ex) { await page.DisplayAlert("Uh Oh :(", $"Unable to remove {store?.Name ?? "Unknown"}, please try again: {ex.Message}", "OK"); } finally { IsBusy = false; } }
public StoreViewModel(CommonYelpClass store, Page page) : base(page) { this.Store = store; }