protected void ShowTaskDetails(TodoItem item) { transaction = TodoItemManager.BeginTransaction(); item = item ?? TodoItemManager.CreateTodoItem(); currentItem = item; taskDialog = new TodoItemDialog(currentItem); context = new BindingContext(this, taskDialog, "Task Details"); detailsScreen = new DialogViewController(context.Root, true); ActivateController(detailsScreen); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); transaction = TodoItemManager.BeginTransaction(); var taskID = Intent.GetStringExtra("TaskID"); if (taskID == null) { task = TodoItemManager.CreateTodoItem(); } else { task = TodoItemManager.GetTask(taskID); } // set our layout to be the home screen SetContentView(Resource.Layout.TaskDetails); nameTextEdit = FindViewById <EditText>(Resource.Id.NameText); notesTextEdit = FindViewById <EditText>(Resource.Id.NotesText); saveButton = FindViewById <Button>(Resource.Id.SaveButton); // TODO: find the Checkbox control and set the value doneCheckbox = FindViewById <CheckBox>(Resource.Id.chkDone); doneCheckbox.Checked = task.Done; // find all our controls cancelDeleteButton = FindViewById <Button>(Resource.Id.CancelDeleteButton); // set the cancel delete based on whether or not it's an existing task cancelDeleteButton.Text = "Delete"; nameTextEdit.Text = task.Name; notesTextEdit.Text = task.Notes; // button clicks cancelDeleteButton.Click += (sender, e) => { CancelDelete(); }; saveButton.Click += (sender, e) => { Save(); }; }