private async void UpdateCheckedTodoItem(TodoItem item) { // This code takes a freshly completed TodoItem and updates the database. When the MobileService // responds, the item is removed from the list await todoTable.UpdateAsync(item); items.Remove(item); }
private async void InsertTodoItem(TodoItem todoItem) { // This code inserts a new TodoItem into the database. When the operation completes // and Mobile Services has assigned an Id, the item is added to the CollectionView await todoTable.InsertAsync(todoItem); items.Add(todoItem); }
public async void OnAdd(object sender, EventArgs e) { var todo = new TodoItem { Name = newItemName.Text }; await AddItem(todo); newItemName.Text = string.Empty; newItemName.Unfocus(); }
private async Task UpdateCheckedTodoItem(TodoItem item) { // This code takes a freshly completed TodoItem and updates the database. When the MobileService // responds, the item is removed from the list await todoTable.UpdateAsync(item); items.Remove(item); ListItems.Focus(Windows.UI.Xaml.FocusState.Unfocused); }
private async Task InsertTodoItem(TodoItem todoItem) { // This code inserts a new TodoItem into the database. After the operation completes // and the mobile app backend has assigned an id, the item is added to the CollectionView. await todoTable.InsertAsync(todoItem); items.Add(todoItem); //await App.MobileService.SyncContext.PushAsync(); // offline sync }
private async Task InsertTodoItem(TodoItem todoItem) { // This code inserts a new TodoItem into the database. When the operation completes // and Mobile App backend has assigned an Id, the item is added to the CollectionView. await todoTable.InsertAsync(todoItem); items.Add(todoItem); //await SyncAsync(); // offline sync }
private async Task UpdateCheckedTodoItem(TodoItem item) { // This code takes a freshly completed TodoItem and updates the database. // After the MobileService client responds, the item is removed from the list. await todoTable.UpdateAsync(item); items.Remove(item); ListItems.Focus(Windows.UI.Xaml.FocusState.Unfocused); //await App.MobileService.SyncContext.PushAsync(); // offline sync }
public async Task SaveTaskAsync(TodoItem item) { if (item.ID == null) { await todoTable.InsertAsync(item); //TodoViewModel.TodoItems.Add(item); } else await todoTable.UpdateAsync(item); }
public async Task DeleteTaskAsync(TodoItem item) { try { //TodoViewModel.TodoItems.Remove(item); await todoTable.DeleteAsync(item); } catch (MobileServiceInvalidOperationException msioe) { Debug.WriteLine(@"INVALID {0}", msioe.Message); } catch (Exception e) { Debug.WriteLine(@"ERROR {0}", e.Message); } }
private void ButtonSave_Click(object sender, RoutedEventArgs e) { var todoItem = new TodoItem { Text = TodoInput.Text }; InsertTodoItem(todoItem); }
async Task CompleteItem(TodoItem item) { item.Done = true; await manager.SaveTaskAsync(item); todoList.ItemsSource = await manager.GetTodoItemsAsync(); }
// Data methods async Task AddItem(TodoItem item) { await manager.SaveTaskAsync(item); todoList.ItemsSource = await manager.GetTodoItemsAsync(); }
private async void ButtonSave_Click(object sender, RoutedEventArgs e) { var todoItem = new TodoItem { Text = TextInput.Text }; TextInput.Text = ""; await InsertTodoItem(todoItem); }
async Task DeleteItem (TodoItem item) { await manager.DeleteTaskAsync(item); todoList.ItemsSource = await manager.GetTodoItemsAsync (); }