private async void OnNavigationBarRightClicked(object sender, EventArgs args) { if (isSaving) { return; } try { isSaving = true; 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 = await TimeEntryModel.CreateFinishedAsync(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); // Ping analytics ServiceContainer.Resolve <ITracker>().SendTimerStartEvent(TimerStartSource.AppManual); } else { model.SetDuration(duration); await model.SaveAsync(); NavigationController.PopViewController(true); } } finally { isSaving = false; } }