private void NavigateToConfirmAppointmentDialog(object obj, NavigateToConfirmAppointmentArgs e) { SelectMeetingDateViewModel selectDateModel = CurrentViewModel as SelectMeetingDateViewModel; this._selectedTimeslots = selectDateModel.GetSelectedTimeSlots(); if (_selectedTimeslots == null || _selectedTimeslots.Count == 0) { return; } this._selectedDate = selectDateModel.SelectedDate; if (_appointmentViewModel == null) { _appointmentViewModel = new AppointmentViewModel(); } _appointmentViewModel.SelectedFacility = _selectedFacility; _appointmentViewModel.Remarks = string.Empty; var selectedEnds = selectDateModel.GetSelectedStartEndTimeslots(); if (selectedEnds.Item1 != null) { _appointmentViewModel.StartTime = selectedEnds.Item1.from.ToSingaporeDateTimeFromEpoch(); } if (selectedEnds.Item2 != null) { _appointmentViewModel.EndTime = selectedEnds.Item2.to.ToSingaporeDateTimeFromEpoch(); } _appointmentViewModel.ErrorMessage = string.Empty; _appointmentViewModel.ClearEventInvocations("AddAppointmentEvent"); _appointmentViewModel.ClearEventInvocations("BackToSelectDate"); AppointmentViewModel.AddAppointmentEvent += new AddAppointmentEventHandler(OnAddAppointment); AppointmentViewModel.BackToSelectDate += new BackToSelectDateEventHandler(BackToSelectDate); // Set the select date view model as the current view model CurrentViewModel = _appointmentViewModel; }