示例#1
0
        /// <summary>
        /// Fetch charts data asynchronously
        /// </summary>
        /// <param name="idPatient"></param>
        /// <returns></returns>
        private async Task FetchChartData(int idPatient)
        {
            IsLoading = true;
            await Task.Run(() =>
            {
                try
                {
                    ServicePatientReference.Patient _selectedPatient = _patientBM.GetPatient(idPatient);
                    List <Observation> observations = _selectedPatient.Observations.OrderBy(x => x.Date).ToList();
                    List <int> weightList           = observations.Select(x => x.Weight).ToList();
                    List <int> pressureList         = observations.Select(x => x.BloodPressure).ToList();
                    List <string> dateList          = observations.Select(x => x.Date.ToString()).ToList();

                    DispatchService.Invoke(() => UpdateGraph(weightList, pressureList, dateList));
                }
                catch
                {
                    DispatchService.Invoke(() => ShowServerExceptionWindow(ErrorDescription.GETSINGLE_PATIENT));
                }
                finally
                {
                    IsLoading = false;
                }
            });
        }
示例#2
0
 /// <summary>
 /// Fetch user data asynchronously
 /// </summary>
 /// <param name="idPatient"></param>
 /// <returns></returns>
 private async Task InitializePatient(int idPatient)
 {
     IsLoading = true;
     await Task.Run(() =>
     {
         try
         {
             SelectedPatient = _patientBM.GetPatient(idPatient);
             ObservableCollection <ServicePatientReference.Observation> list = new ObservableCollection <ServicePatientReference.Observation>();
             List <int> weightList   = new List <int>();
             List <int> pressureList = new List <int>();
             List <string> dateList  = new List <string>();
             foreach (ServicePatientReference.Observation observation in SelectedPatient.Observations)
             {
                 list.Add(observation);
                 weightList.Add(observation.Weight);
                 pressureList.Add(observation.BloodPressure);
                 dateList.Add(observation.Date.ToString());
             }
             DispatchService.Invoke(() =>
             {
                 ObservationsList = list;
                 UpdateGraph(weightList, pressureList, dateList);
             });
         }
         catch (Exception e)
         {
             DispatchService.Invoke(() => ShowServerExceptionWindow(ErrorDescription.GET_PATIENT_OBSERVATION));
         }
         finally
         {
             IsLoading = false;
         }
     });
 }
示例#3
0
        /// <summary>
        /// Initialize patient infos
        /// </summary>
        /// <param name="idPatient"></param>
        /// <returns></returns>
        private async Task InitializePatient(int idPatient)
        {
            IsLoading = true;

            await Task.Run(() =>
            {
                try
                {
                    SelectedPatient = _patientBM.GetPatient(idPatient);
                    if (SelectedPatient.Observations != null)
                    {
                        ObservationsNb = SelectedPatient.Observations.Length;
                    }
                }
                catch
                {
                    DispatchService.Invoke(() => ShowServerExceptionWindow(ErrorDescription.GETSINGLE_PATIENT));
                }
                finally
                {
                    IsLoading = false;
                }
            });
        }