Beispiel #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            View.MainWindow      window   = new colle_tMedecine.View.MainWindow();
            ViewModel.MainWindow windowVM = new ViewModel.MainWindow();

            windowVM.MenuIsActive = false;
            window.DataContext    = windowVM;

            View.Login login_view       = new colle_tMedecine.View.Login();
            ViewModel.LoginViewModel vm = new colle_tMedecine.ViewModel.LoginViewModel();
            login_view.DataContext        = vm;
            window.contentcontrol.Content = login_view;



            /* View.Nouveau_Personnel menu = new colle_tMedecine.View.Nouveau_Personnel();
             * ViewModel.Nouveau_PersonnelViewModel fm = new colle_tMedecine.ViewModel.Nouveau_PersonnelViewModel();
             * menu.DataContext = fm;
             * window.contentcontrol.Content = menu;*/


            window.Show();
            // Application.Current.MainWindow.DataContext;
        }
Beispiel #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            View.MainWindow window = new colle_tMedecine.View.MainWindow();
            ViewModel.MainWindow windowVM = new ViewModel.MainWindow();

            windowVM.MenuIsActive = false;
            window.DataContext = windowVM;

            View.Login login_view = new colle_tMedecine.View.Login();
            ViewModel.LoginViewModel vm = new colle_tMedecine.ViewModel.LoginViewModel();
            login_view.DataContext = vm;
            window.contentcontrol.Content = login_view;

               /* View.Nouveau_Personnel menu = new colle_tMedecine.View.Nouveau_Personnel();
            ViewModel.Nouveau_PersonnelViewModel fm = new colle_tMedecine.ViewModel.Nouveau_PersonnelViewModel();
            menu.DataContext = fm;
            window.contentcontrol.Content = menu;*/

            window.Show();
            // Application.Current.MainWindow.DataContext;
        }
        public void FillListUser()
        {
            ServiceUser.ServiceUserClient service = new ServiceUser.ServiceUserClient();
            try
            {
                ServiceUser.User[] listUser = service.GetListUser();
                _allUser = new List<Model.User>();
                foreach (ServiceUser.User user in listUser)
                {
                    Model.User userModel = new Model.User
                    {
                        Login = user.Login,
                        Password = user.Pwd,
                        Name = user.Name,
                        Firstname = user.Firstname,
                        Pic = user.Picture,
                        Role = user.Role,
                        Co = user.Connected
                    };
                    userModel.Name = FirstUpper(userModel.Name);
                    userModel.Firstname = FirstUpper(userModel.Firstname);
                    userModel.Role = FirstUpper(userModel.Role);
                    this._allUser.Add(userModel);
                }
                ListUser = new ObservableCollection<Model.User>(_allUser);
            }
            catch
            {
                MainWindow main = new MainWindow();
                View.MainWindow mainwindow = (View.MainWindow)Application.Current.MainWindow;

                View.Personnel view = new colle_tMedecine.View.Personnel();
                ViewModel.PersonnelViewModel vm = new colle_tMedecine.ViewModel.PersonnelViewModel();
                view.DataContext = vm;
                main.navigate((UserControl)mainwindow.contentcontrol.Content, view);
            }
        }
        public void FillListPatient()
        {
            ServicePatient.ServicePatientClient service = new ServicePatient.ServicePatientClient();
            try
            {
                ServicePatient.Patient[] listPatient = service.GetListPatient();
                this._allPatient = new List<Model.Patient>();
                List<Model.Observation> listObs = new List<Model.Observation>();

                foreach (ServicePatient.Patient pat in listPatient)
                {
                    Model.Patient patient = new Model.Patient
                    {
                        Birth = pat.Birthday,
                        Firstname = pat.Firstname,
                        Name = pat.Name,
                        Id = pat.Id
                    };

                    if (pat.Observations != null)
                    {
                        foreach (ServicePatient.Observation obs in pat.Observations)
                        {
                            Model.Observation observation = new Model.Observation
                            {
                                Comments = obs.Comment,
                                Date = obs.Date,
                                Pic = obs.Pictures ?? new List<byte[]>().ToArray(),
                                Prescriptions = obs.Prescription.ToList() ?? new List<string>(),
                                Pressure = obs.BloodPressure,
                                Weight = obs.Weight
                            };
                            listObs.Add(observation);
                        }
                        patient.Obs = listObs;
                    }

                    patient.Name = FirstUpper(patient.Name);
                    patient.Firstname = FirstUpper(patient.Firstname);
                    patient.Birthday = pat.Birthday.ToString("dd/MM/yyyy");

                    this._allPatient.Add(patient);
                }
                ListPatient = new ObservableCollection<Model.Patient>(this._allPatient);
            }
            catch
            {
                MainWindow main = new MainWindow();
                View.MainWindow mainwindow = (View.MainWindow)Application.Current.MainWindow;

                View.Patients view = new colle_tMedecine.View.Patients();
                ViewModel.PatientsViewModel vm = new colle_tMedecine.ViewModel.PatientsViewModel();
                view.DataContext = vm;

                main.navigate((UserControl)mainwindow.contentcontrol.Content, view);
            }
        }