public OverviewPageViewModel(IViewModelCommunication viewModelCommunication, IDateDisplayViewModel dateDisplayViewModel, IMedicalPracticeSelectorViewModel medicalPracticeSelectorViewModel, IRoomFilterViewModel roomFilterViewModel, IDateSelectorViewModel dateSelectorViewModel, IGridContainerViewModel gridContainerViewModel, IUndoRedoViewModel undoRedoViewModel, IWindowBuilder <Views.AddAppointmentDialog> addAppointmentDialogBuilder, PrintDialogWindowBuilder printDialogBuilder, ISharedStateReadOnly <AppointmentModifications> appointmentModificationsVariable, ISharedStateReadOnly <Guid> selectedMedicalPracticeIdVariable, ISharedStateReadOnly <Date> selectedDayVariable, IClientMedicalPracticeRepository medicalPracticeRepository, Action <string> errorCallback) { this.appointmentModificationsVariable = appointmentModificationsVariable; this.selectedMedicalPracticeIdVariable = selectedMedicalPracticeIdVariable; this.selectedDayVariable = selectedDayVariable; this.medicalPracticeRepository = medicalPracticeRepository; this.errorCallback = errorCallback; DateDisplayViewModel = dateDisplayViewModel; MedicalPracticeSelectorViewModel = medicalPracticeSelectorViewModel; RoomFilterViewModel = roomFilterViewModel; DateSelectorViewModel = dateSelectorViewModel; GridContainerViewModel = gridContainerViewModel; UndoRedoViewModel = undoRedoViewModel; ChangeConfirmationVisible = false; AddAppointmentPossible = false; appointmentModificationsVariable.StateChanged += OnCurrentModifiedAppointmentVariableChanged; selectedMedicalPracticeIdVariable.StateChanged += OnSelectedMedicalPracticeIdVariableChanged; selectedDayVariable.StateChanged += OnSelectedDayVariablChanged; ShowAddAppointmentDialog = new Command(() => { viewModelCommunication.Send(new ShowDisabledOverlay()); var dialogWindow = addAppointmentDialogBuilder.BuildWindow(); dialogWindow.ShowDialog(); //addAppointmentDialogBuilder.DisposeWindow(dialogWindow); viewModelCommunication.Send(new HideDisabledOverlay()); }); ShowPrintDialog = new Command(() => { viewModelCommunication.Send(new ShowDisabledOverlay()); var dialogWindow = printDialogBuilder.BuildWindow(new AggregateIdentifier(selectedDayVariable.Value, selectedMedicalPracticeIdVariable.Value)); dialogWindow.ShowDialog(); //printDialogBuilder.DisposeWindow(dialogWindow); viewModelCommunication.Send(new HideDisabledOverlay()); }); UpdateAddAppointmentPossible(); }
private void ShowAboutDialog() { viewModelCommunication.Send(new ShowDisabledOverlay()); var dialogWindow = dialogBuilder.BuildWindow(); dialogWindow.ShowDialog(); viewModelCommunication.Send(new HideDisabledOverlay()); }
public House BuildHouse() { var floor = _floorBuilder.BuildFloor(2); var window = _windowBuilder.BuildWindow(5, 5); var roof = _roofBuilder.BuildRoof(10, 10, 10); var house = new House(window, floor, roof); return(house); }
public AppointmentViewModel(Appointment appointment, ICommandService commandService, IViewModelCommunication viewModelCommunication, TherapyPlaceRowIdentifier initialLocalisation, ISharedState <AppointmentModifications> appointmentModificationsVariable, ISharedState <Date> selectedDateVariable, IAppointmentModificationsBuilder appointmentModificationsBuilder, IWindowBuilder <EditDescription> editDescriptionWindowBuilder, AdornerControl adornerControl, Action <string> errorCallback) { this.appointment = appointment; this.initialLocalisation = initialLocalisation; this.appointmentModificationsVariable = appointmentModificationsVariable; this.selectedDateVariable = selectedDateVariable; ViewModelCommunication = viewModelCommunication; AdornerControl = adornerControl; viewModelCommunication.RegisterViewModelAtCollection <IAppointmentViewModel, Guid>( Constants.ViewModelCollections.AppointmentViewModelCollection, this ); SwitchToEditMode = new ParameterrizedCommand <bool>( isInitalAdjusting => { if (appointmentModificationsVariable.Value == null) { CurrentAppointmentModifications = appointmentModificationsBuilder.Build(appointment, initialLocalisation.PlaceAndDate.MedicalPracticeId, isInitalAdjusting, errorCallback); CurrentAppointmentModifications.PropertyChanged += OnAppointmentModificationsPropertyChanged; appointmentModificationsVariable.Value = CurrentAppointmentModifications; OperatingMode = OperatingMode.Edit; appointmentModificationsVariable.StateChanged += OnCurrentModifiedAppointmentChanged; } } ); DeleteAppointment = new Command( async() => { var dialog = new UserDialogBox("", "Wollen Sie den Termin wirklich löschen?", MessageBoxButton.OKCancel); var result = await dialog.ShowMahAppsDialog(); if (result == MessageDialogResult.Affirmative) { if (appointmentModificationsVariable.Value.IsInitialAdjustment) { viewModelCommunication.SendTo( // Constants.ViewModelCollections.AppointmentViewModelCollection, // do nothing but appointmentModificationsVariable.Value.OriginalAppointment.Id, // deleting the temporarly new Dispose() // created Appointment ); // } else { commandService.TryDeleteAppointment( operationSuccessful => { Application.Current.Dispatcher.Invoke(() => { if (!operationSuccessful) { Process(new RestoreOriginalValues()); viewModelCommunication.Send(new ShowNotification("löschen des Termins fehlgeschlagen; bearbeitung wurde zurückgesetzt", 5)); } }); }, currentLocation.PlaceAndDate, appointment.Patient.Id, appointment.Id, appointment.Description, appointment.StartTime, appointment.EndTime, appointment.TherapyPlace.Id, appointment.Label.Id, ActionTag.RegularAction, errorCallback ); } appointmentModificationsVariable.Value = null; } } ); EditDescription = new Command( () => { viewModelCommunication.Send(new ShowDisabledOverlay()); var dialog = editDescriptionWindowBuilder.BuildWindow(); dialog.ShowDialog(); viewModelCommunication.Send(new HideDisabledOverlay()); } ); ConfirmChanges = new Command(() => viewModelCommunication.Send(new ConfirmChanges())); RejectChanges = new Command(() => viewModelCommunication.Send(new RejectChanges())); BeginTime = appointment.StartTime; EndTime = appointment.EndTime; Description = appointment.Description; LabelColor = appointment.Label.Color; ShowDisabledOverlay = false; SetNewLocation(initialLocalisation, true); }