public async void AddItem(View view) { if (client == null || string.IsNullOrWhiteSpace(textNewToDo.Text)) { return; } // Create a new item var item = new ToDoItem { Text = textNewToDo.Text, Complete = false }; try { await toDoTable.InsertAsync(item); // insert the new item into the local database await SyncAsync(); // send changes to the mobile service if (!item.Complete) { adapter.Add(item); } } catch (Exception e) { CreateAndShowDialog(e, "Error"); } textNewToDo.Text = ""; }
public ToDoItemWrapper(ToDoItem item) { ToDoItem = item; }
public async Task CheckItem(ToDoItem item) { if (client == null) { return; } // Set the item as completed and update it in the table item.Complete = true; try { await toDoTable.UpdateAsync(item); // update the new item in the local database await SyncAsync(); // send changes to the mobile service if (item.Complete) adapter.Remove(item); } catch (Exception e) { CreateAndShowDialog(e, "Error"); } }