public void SaveTask (TodoItem task) { Console.WriteLine("Save "+task.Name); var oldTask = tasks.Find(t => t.Id == task.Id); oldTask = task; NavigationController.PopViewController(true); }
public void CreateTask () { // first, add the task to the underlying data var newId = tasks[tasks.Count - 1].Id + 1; var newTask = new TodoItem(){Id=newId}; tasks.Add (newTask); // then open the detail view to edit it var detail = Storyboard.InstantiateViewController("detail") as TaskDetailViewController; detail.SetTask (this, newTask); NavigationController.PushViewController (detail, true); // Could to this instead of the above, but need to create 'new Task()' in PrepareForSegue() //this.PerformSegue ("TaskSegue", this); }
public RootTableSource (TodoItem[] items) { tableItems = items; }
public void DeleteTask (TodoItem task) { Console.WriteLine("Delete "+task.Name); var oldTask = tasks.Find(t => t.Id == task.Id); tasks.Remove (oldTask); NavigationController.PopViewController(true); }
// this will be called before the view is displayed public void SetTask (RootViewController d, TodoItem task) { Delegate = d; currentTask = task; }