public void Update (Task item) { ID = item.ID; Name = item.Name; Notes = item.Notes; Done = item.Done; }
protected void ShowTaskDetails (Task task) { currentTask = task; taskDialog = new TaskDialog (task); var title = Foundation.NSBundle.MainBundle.LocalizedString ("Task Details", "Task Details"); context = new LocalizableBindingContext (this, taskDialog, title); detailsScreen = new DialogViewController (context.Root, true); ActivateController(detailsScreen); }
/// <summary> /// Insert or update a task /// </summary> public int SaveTask (Task item) { var max = 0; if (tasks.Count > 0) max = tasks.Max(x => x.ID); if (item.ID == 0) { item.ID = ++max; tasks.Add (item); } else { //HACK: why isn't Find available in PCL ? //var i = tasks.Find (x => x.ID == item.ID); var j = tasks.Where (x => x.ID == item.ID).First(); j = item; // replaces item in collection with updated value } storage.WriteXml (tasks, storeLocation); return max; }
public TaskViewModel (Task item) { Update (item); }
public int SaveTask (Task item) { return repository.SaveTask(item); }