Exemple #1
0
        private readonly CentralDesk _centralDesk;     //backend  instance of cental desk logic

        /// <summary>
        /// Central Desk presenter constructor, which is an interface between the frontend views and backend models
        /// </summary>
        /// <param name="view"></param>
        /// <param name="service"></param>
        /// <param name="staff"></param>
        /// <param name="patientSimulator"></param>
        public CentralDeskPresenter(ICentralDeskView view, RegistrationService service, Staff staff, CentralDesk patientSimulator)
        {
            //object instances declared in the constructor method call, passed into the presenter fields declared above
            //allows the presenter to interface between the backend model and the front end UI view
            _view        = view;
            _service     = service;
            _staff       = staff;
            _centralDesk = patientSimulator;

            //per patient button click handler
            _view.ViewPatient1 += () => ViewPatient(_view.Room1);
            _view.ViewPatient2 += () => ViewPatient(_view.Room2);
            _view.ViewPatient3 += () => ViewPatient(_view.Room3);
            _view.ViewPatient4 += () => ViewPatient(_view.Room4);
            _view.ViewPatient5 += () => ViewPatient(_view.Room5);
            _view.ViewPatient6 += () => ViewPatient(_view.Room6);
            _view.ViewPatient7 += () => ViewPatient(_view.Room7);
            _view.ViewPatient8 += () => ViewPatient(_view.Room8);

            //button handler for when sign out clicked
            _view.SignOut += SignOut;

            //event handler for loading data to the ui
            _view.LoadData += LoadData;

            //event handler for change panel colour timer
            _view.ChangePanelColour += ChangePanelColour;
        }
Exemple #2
0
        private Staff _staff;                      //instance of staff signed in and viewing the patient

        /// <summary>
        /// Patient Module View presenter constructor, which is an interface between the frontend views and backend models
        /// </summary>
        /// <param name="patient"></param>
        /// <param name="view"></param>
        /// <param name="centralDesk"></param>
        /// <param name="staff"></param>
        /// <param name="service"></param>
        public PatientModuleViewPresenter(Patient patient, IPatientModuleView view, CentralDesk centralDesk, Staff staff, AlarmRegistrationService service)
        {
            //object instances declared in the constructor method call, passed into the presenter fields declared above
            //allows the presenter to interface between the backend model and the front end UI view
            _patient          = patient;
            _view             = view;
            _centralDesk      = centralDesk;
            _staff            = staff;
            _service          = service;
            patientModuleList = _centralDesk.Patients.ElementAt(_patient.PatientID - 1).Modules; //list of modules of current patient

            _view.LoadPatientData += () => LoadPatientData();                                    //on form loads backend models data
            //event handlers for setting modules boundaries, view properties from textboxes passed as arguments
            _view.SetPulseRate            += () => SetPulseRate(_view.LowerPulseRate, _view.UpperPulseRate);
            _view.SetBreathingRate        += () => SetBreathingRate(_view.LowerBreathingRate, _view.UpperBreathingRate);
            _view.SetBloodPressure        += () => SetBloodPressure(_view.LowerBloodPressure, _view.UpperBloodPressure);
            _view.SetTemperature          += () => SetTemperature(_view.LowerTemperature, _view.UpperTemperature);
            _view.GoBack                  += GoBack;                  //button handler for returning back to CentralDeskView
            _view.UpdatePatientModuleData += UpdatePatientModuleData; //timer triggered event for updating patient data
            _view.RectifyAlarm            += RectifyAlarm;            //alarm rectification handler
        }