private void OnNavigationBarRightClicked(object sender, EventArgs args) { var duration = TimeSpan.Zero; var entered = durationView.EnteredDuration; if (model == null || model.State == TimeEntryState.New) { duration = new TimeSpan(entered.Hours, entered.Minutes, 0); } else { duration = model.GetDuration(); // Keep the current seconds and milliseconds duration = new TimeSpan(0, entered.Hours, entered.Minutes, duration.Seconds, duration.Milliseconds); } if (model == null) { var m = TimeEntryModel.CreateFinished(duration); var controller = new EditTimeEntryViewController(m); // Replace self with edit controller on the stack var vcs = NavigationController.ViewControllers; vcs [vcs.Length - 1] = controller; NavigationController.SetViewControllers(vcs, true); } else { model.SetDuration(duration); NavigationController.PopViewControllerAnimated(true); } }