public async void OnAdd (object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace (newItemName.Text)) { var todo = new TodoItem { Name = newItemName.Text }; await AddItem (todo); } newItemName.Text = string.Empty; newItemName.Unfocus (); }
public async Task SaveTaskAsync(TodoItem item) { if (item.Id == null) { await todoTable.InsertAsync(item); } else { await todoTable.UpdateAsync(item); } }
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(); }