예제 #1
0
 private void chosenPatient_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     Filemanagement.ReadBirthRecords((Patient)chosenPatient.SelectedItem);
     Messenger.Default.Send <Employee>((Employee)chosenPatient.Tag, "Employee");
     Messenger.Default.Send <Patient>((Patient)chosenPatient.SelectedItem, "Patient");
     Messenger.Default.Send <NotificationMessage>(new NotificationMessage("ToPatient"));
 }
예제 #2
0
        public HomeScreenViewModel()
        {
            Messenger.Default.Register <Employee>(this, "ActiveUser", (ActiveUser) => { CurrentEmployee = ActiveUser; });
            Messenger.Default.Register <Employee>(this, "ReturnEmployee", (ActiveUser) => { CurrentEmployee = ActiveUser; });
            Messenger.Default.Register <NotificationMessage>(this, bw_StartWorker);

            //Command to log the user out of the system
            this.LogOutCommand = new RelayCommand(parameter =>
            {
                logoutCommand();
            });
            //Command to close to program
            this.ExitCommand = new RelayCommand(parameter =>
            {
                Application.Current.Shutdown();
            });
            //Command to find a patient from a userinput
            this.FindPatientCommand = new RelayCommand(parameter =>
            {
                SelectedPatient = FindPatient(CPR);
                if (SelectedPatient != null)
                {
                    Messenger.Default.Send <Employee>(CurrentEmployee, "Employee");
                    Messenger.Default.Send <Patient>(SelectedPatient, "Patient");
                    Messenger.Default.Send <NotificationMessage>(new NotificationMessage("ToPatient"));
                }
                else
                {
                    Messenger.Default.Send <NotificationMessage>(new NotificationMessage("NoCPRInput"));
                }
            });
            //Command to open the view where the user can add a patient to their active patients
            this.OpenAddPatientCommand = new RelayCommand(parameter =>
            {
                Messenger.Default.Send(new NotificationMessage("ToDialog"));
                Messenger.Default.Send <Employee>(CurrentEmployee, "Employee");
            });
            //Command to open the patient view
            this.OpenPatientCommand = new RelayCommand(parameter =>
            {
                Messenger.Default.Send <Employee>(CurrentEmployee, "Employee");
                Messenger.Default.Send <Patient>(SelectedPatient, "Patient");
                Messenger.Default.Send <NotificationMessage>(new NotificationMessage("ToPatient"));
            });
            //Command to open the patient view when a patient is clicked in the list of active patients
            this.OpenPatientOnClick = new RelayCommand(parameter =>
            {
                if (SelectedPatient != null)
                {
                    Filemanagement.ReadBirthRecords(SelectedPatient);
                    Messenger.Default.Send <Employee>(CurrentEmployee, "Employee");
                    Messenger.Default.Send <Patient>(SelectedPatient, "Patient");
                    Messenger.Default.Send <NotificationMessage>(new NotificationMessage("ToPatient"));
                }
            });
            bw.RunWorkerAsync();
            bw.WorkerSupportsCancellation = true;
            bw.DoWork             += new DoWorkEventHandler(bw_DoWork);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
        }