public int Save(Todo t) { if (t.Id != 0) { conn.Update (t); return t.Id; } else { return conn.Insert (t); } }
public override void ViewDidLoad () { base.ViewDidLoad (); addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, (s,e) =>{ var todo = new Todo() { // TODO: iOS localize the placeholder text Title= Lion.Localize("<new task>", "<new task>") }; AppDelegate.Current.TodoDB.Save (todo); var todoView = new TodoViewController(todo); NavigationController.PushViewController (todoView, true); }); NavigationItem.RightBarButtonItem = addButton; }
public override void ViewDidLoad () { base.ViewDidLoad (); addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, (s,e) =>{ var todo = new Todo() { Title= Lion.Localize("<new task>", "<new task>") }; AppDelegate.Current.TodoDB.Save (todo); var detail = Storyboard.InstantiateViewController("detail") as TodoViewController; detail.SetTask (this, todo); NavigationController.PushViewController (detail, true); }); NavigationItem.RightBarButtonItem = addButton; }
public TodoViewController (Todo todo) { currentTodo = todo; //TODO: iOS we use the native method here (just as an example) Title = NSBundle.MainBundle.LocalizedString ("Task Details", "Task Details"); }
public int Delete(Todo t) { return conn.Delete (t); }
// this will be called before the view is displayed public void SetTask (TodoListViewController d, Todo todo) { Delegate = d; currentTodo = todo; }