public async Task SaveTodoItemAsync(TodoItem todoItem) { if (todoItem.ID == null) await todoTable.InsertAsync(todoItem); else await todoTable.UpdateAsync(todoItem); }
public void CreateTask () { // first, add the task to the underlying data var newTodo = new TodoItem(); // then open the detail view to edit it var detail = Storyboard.InstantiateViewController("detail") as TaskDetailViewController; detail.SetTask (newTodo); NavigationController.PushViewController (detail, true); // Could to this instead of the above, but need to create 'new Task()' in PrepareForSegue() //this.PerformSegue ("TaskSegue", this); }
protected async override void OnCreate (Bundle bundle) { base.OnCreate (bundle); View titleView = Window.FindViewById(Android.Resource.Id.Title); if (titleView != null) { IViewParent parent = titleView.Parent; if (parent != null && (parent is View)) { View parentView = (View)parent; parentView.SetBackgroundColor(Color.Rgb(0x26, 0x75 ,0xFF)); //38, 117 ,255 } } // set our layout to be the home screen SetContentView(Resource.Layout.TaskDetails); nameTextEdit = FindViewById<EditText>(Resource.Id.txtName); notesTextEdit = FindViewById<EditText>(Resource.Id.txtNotes); saveButton = FindViewById<Button>(Resource.Id.btnSave); doneCheckbox = FindViewById<CheckBox>(Resource.Id.chkDone); cancelDeleteButton = FindViewById<Button>(Resource.Id.btnCancelDelete); // button clicks cancelDeleteButton.Click += (sender, e) => { CancelDelete(); }; saveButton.Click += (sender, e) => { Save(); }; string taskID = Intent.GetStringExtra("TaskID"); if(!String.IsNullOrEmpty(taskID)) { //HACK: task = AppDelegate.Current.TaskMgr.GetTask(taskID); task = await AppDelegate.Current.TaskMgr.GetTaskAsync(taskID); } // set the cancel delete based on whether or not it's an existing task cancelDeleteButton.Text = (String.IsNullOrEmpty(task.ID) ? "Cancel" : "Delete"); nameTextEdit.Text = task.Name; notesTextEdit.Text = task.Notes; doneCheckbox.Checked = task.Done; }
public RootTableSource (TodoItem[] items) { tableItems = items; }
// this will be called before the view is displayed (from the list screen) public void SetTask (TodoItem todo) { currentTodoItem = todo; }
public async Task DeleteTodoItemAsync(TodoItem item) { try { await todoTable.DeleteAsync(item); } catch (MobileServiceInvalidOperationException msioe) { Console.Error.WriteLine(@"INVALID {0}", msioe.Message); } catch (Exception e) { Console.Error.WriteLine(@"ERROR {0}", e.Message); } }
public Task DeleteTaskAsync (TodoItem item) { return storage.DeleteTodoItemAsync(item); }
public Task SaveTaskAsync (TodoItem item) { return storage.SaveTodoItemAsync(item); }
public int SaveTask (TodoItem item) { return db.SaveItem<TodoItem>(item); }
public int SaveTask(TodoItem item) { return(db.SaveItem <TodoItem>(item)); }
public int DeleteTask(TodoItem item) { return repository.DeleteTask(item.ID); }
public int SaveTask (TodoItem item) { return repository.SaveTask(item); }