private void JourneyButton_Click(object sender, EventArgs e) { JourneyPointIndex = 1; if (JourneyRepository == null) { JourneyRepository = new JourneyRepository(); } JourneyIsInProgress = !JourneyIsInProgress; var journeyButton = FindViewById <Button>(Resource.Id.btnMainJourneyButton); var spinner = FindViewById <Spinner>(Resource.Id.driverSelectSpinner); if (JourneyIsInProgress) { if (TripId == int.MinValue) { Toast.MakeText(this, "Set An Active Trip", ToastLength.Long).Show(); return; } distance = 0; JourneyRepository.CountMetricToday(TripId, out todayDistance, out timeToday); NewJourneyId = JourneyRepository.StartNewJourney(SelectedDriverId, TripId); JourneyStarted = DateTime.Now; journeyButton.Text = "End Journey"; spinner.Enabled = false; timer.Enabled = true; RootApp.StartLocationService(); } else { RootApp.StopLocationService(); JourneyEnded = DateTime.Now; journeyButton.Text = "Start Journey"; spinner.Enabled = true; timer.Enabled = false; FragmentTransaction transaction = FragmentManager.BeginTransaction(); var dialog = new Forms.AddNewStopPoint(); dialog.JourneyId = NewJourneyId; dialog.OnGetPlaceName += Dialog_OnGetPlaceName; dialog.Show(transaction, "dialog"); NewJourneyId = int.MinValue; previousLocation = null; } }