Пример #1
0
        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();
        }
Пример #2
0
 public WindowHandler(IWindowFadeManager windowFadeManager, IWindowBuilder windowBuilder,
                      IWindowScenarioFactory scenarioFactory)
 {
     _windowFadeManager = windowFadeManager;
     _scenarioFactory   = scenarioFactory;
     _windowBuilder     = windowBuilder;
 }
Пример #3
0
        public ActionBarViewModel(ISession session,
                                  IConnectionStatusViewModel connectionStatusViewModel,
                                  IViewModelCommunication viewModelCommunication,
                                  IWindowBuilder <Views.AboutDialog> dialogBuilder)
        {
            this.session = session;
            this.viewModelCommunication = viewModelCommunication;
            this.dialogBuilder          = dialogBuilder;
            ConnectionStatusViewModel   = connectionStatusViewModel;

            var titleBuilder = new StringBuilder();

#if DEBUG
            titleBuilder.Append(">>> DEBUG <<<    ");
#endif
            titleBuilder.Append("OnkoTePla - Version ");
            titleBuilder.Append(ApplicationInfo.ClientVersion);

#if DEBUG
            titleBuilder.Append("    >>> DEBUG <<<");
#endif

            Title = titleBuilder.ToString();

            ShowOverview = new Command(() => viewModelCommunication.Send(new ShowPage(MainPage.Overview)));
            ShowSearch   = new Command(() => viewModelCommunication.Send(new ShowPage(MainPage.Search)));
            ShowOptions  = new Command(() => viewModelCommunication.Send(new ShowPage(MainPage.Options)));

            ShowAbout = new Command(ShowAboutDialog);
            Logout    = new Command(DoLogOut);

            session.ApplicationStateChanged += OnApplicationStateChanged;
            OnApplicationStateChanged(session.CurrentApplicationState);
        }
Пример #4
0
        static void SetSizeByDeviceDimensions(IWindowBuilder builder)
        {
            int width  = 800;
            int height = 600;

            builder.SetDimensions(width, height);
        }
Пример #5
0
        public ActionBarViewModel(ISession session,
                                  IConnectionStatusViewModel connectionStatusViewModel,
                                  IViewModelCommunication viewModelCommunication,
                                  IWindowBuilder <Views.AboutDialog> dialogBuilder)
        {
            this.session = session;
            this.viewModelCommunication = viewModelCommunication;
            this.dialogBuilder          = dialogBuilder;
            ConnectionStatusViewModel   = connectionStatusViewModel;

            ShowOverview = new Command(() => viewModelCommunication.Send(new ShowPage(MainPage.Overview)));
            ShowSearch   = new Command(() => viewModelCommunication.Send(new ShowPage(MainPage.Search)));
            ShowOptions  = new Command(() => viewModelCommunication.Send(new ShowPage(MainPage.Options)));

            ShowAbout = new Command(ShowAboutDialog);
            Logout    = new Command(DoLogOut);

            session.ApplicationStateChanged += OnApplicationStateChanged;
            OnApplicationStateChanged(session.CurrentApplicationState);
        }
Пример #6
0
        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);
        }
Пример #7
0
 public HouseBuilder(IFloorBuilder floorBuilder, IRoofBuilder roofBuilder, IWindowBuilder windowBuilder)
 {
     _floorBuilder  = floorBuilder;
     _roofBuilder   = roofBuilder;
     _windowBuilder = windowBuilder;
 }