private async void CheckBoxComplete_Checked(object sender, RoutedEventArgs e) { CheckBox cb = (CheckBox)sender; GroceryListItems item = cb.DataContext as GroceryListItems; await UpdateCheckedGrocListItem(item); }
private async Task UpdateCheckedGrocListItem(GroceryListItems item) { // This code takes a freshly completed GroceryList and updates the database. When the MobileService // responds, the item is removed from the list await grocList.UpdateAsync(item); items.Remove(item); ListItems.Focus(Windows.UI.Xaml.FocusState.Unfocused); }
async private void AddGroceryItem_Clicked(object sender, RoutedEventArgs e) { try { GroceryListItems item = new GroceryListItems { username = MainPage.SessionUser.sessionUsername, Text = groceryItem.Text, Complete = false }; await App.MobileService.GetTable <GroceryListItems>().InsertAsync(item); var dialog = new MessageDialog("Successful!"); await dialog.ShowAsync(); } catch (Exception em) { var dialog = new MessageDialog("An Error Occured: " + em.Message); await dialog.ShowAsync(); } }