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 {
				// Insert the new item
				await toDoTable.InsertAsync (item);

				if (!item.Complete) {
					adapter.Add (item);
				}
			} catch (Exception e) {
				CreateAndShowDialog (e, "Error");
			}

			textNewToDo.Text = "";
		}
예제 #2
0
		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);
				if (item.Complete)
					adapter.Remove (item);

			} catch (Exception e) {
				CreateAndShowDialog (e, "Error");
			}
		}
예제 #4
0
 public ToDoItemWrapper(ToDoItem item)
 {
     ToDoItem = item;
 }