コード例 #1
0
 void UpdateVaccineList()
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         if (CurrentChild != null)
         {
             Vaccines           = CurrentChild.GetListOfDueVaccines();
             HistoricalVaccines = CurrentChild.GetVaccineHistory();
             initializeVaccinations();
         }
         else
         {
             Vaccines           = new List <Vaccine>();
             HistoricalVaccines = new List <Vaccine>();
             initializeVaccinations();
         }
     });
 }
コード例 #2
0
        private void updateFields()
        {
            if (CurrentChild == null)
            {
                childBirthday.Text                = "NaN";
                heightMeasurement.Text            = "NaN";
                weightMeasurement.Text            = "NaN";
                headCircumferenceMeasurement.Text = "NaN";
                MeasurementsAlert.Text            = "N/A";
                milestonesAlert.Text              = "N/A";
                vaccinationsAlert.Text            = "N/A";
                emotionalAndSocial.Text           = "0%";
                physicalGrowth.Text               = "0%";
                LanguageDevelopment.Text          = "0%";
                ThinkingAndReasoning.Text         = "0%";

                progressBar1.Progress = 0;
                warning.Clear();
            }
            else
            {
                // Get last input dates

                DateTime maxDateofWeight = CurrentChild.Measurements.weightData.Keys.Count == 0 ? DateTime.MinValue : CurrentChild.Measurements.weightData.Keys.Max();
                DateTime maxDateofHeight = CurrentChild.Measurements.heightData.Keys.Count == 0 ? DateTime.MinValue : CurrentChild.Measurements.heightData.Keys.Max();
                DateTime maxDateofHead   = CurrentChild.Measurements.headCircumferenceData.Keys.Count == 0 ? DateTime.MinValue : CurrentChild.Measurements.headCircumferenceData.Keys.Max();

                // Check if these dates matches today
                if (maxDateofHead.Date == DateTime.Today.Date &&
                    maxDateofHeight.Date == DateTime.Today.Date &&
                    maxDateofWeight.Date == DateTime.Today.Date)
                {
                    measurementsImage.Source = "check_1";
                    if (CurrentContext.CurrentLanguage == Language.ENGLISH)
                    {
                        MeasurementsAlert.Text = "All Measurements Completed For Today";
                    }
                    else
                    {
                        MeasurementsAlert.Text = "Todas las medidas estan al día";
                    }
                }

                // Check if Milestones Completed
                List <Milestone> milestoneList = CurrentChild.GetListOfDueMilestones();
                if (milestoneList == null || milestoneList.Count == 1)
                {
                    milestonesImage.Source = "check_1";
                    if (CurrentContext.CurrentLanguage == Language.ENGLISH)
                    {
                        milestonesAlert.Text = "All Milestones Completed For Today";
                    }
                    else
                    {
                        milestonesAlert.Text = "Todos los Alcances estan al día";
                    }
                }
                else
                {
                    int count = milestoneList.Count - 1;
                    if (CurrentContext.CurrentLanguage == Language.ENGLISH)
                    {
                        milestonesAlert.Text = count.ToString() + " milestones unanswered";
                    }
                    else
                    {
                        milestonesAlert.Text = count.ToString() + " Alcances sin responder";
                    }
                }

                //Check if Vaccination Completed
                List <Vaccine> vaccineList = CurrentChild.GetListOfDueVaccines();
                if (vaccineList == null || vaccineList.Count == 0)
                {
                    vaccinationsImage.Source = "check_1";
                    if (CurrentContext.CurrentLanguage == Language.ENGLISH)
                    {
                        vaccinationsAlert.Text = "All Vaccinations Completed For Today";
                    }
                    else
                    {
                        vaccinationsAlert.Text = "Todas las vacunas estan al día";
                    }
                }
                else
                {
                    if (CurrentContext.CurrentLanguage == Language.ENGLISH)
                    {
                        vaccinationsAlert.Text = vaccineList.Count.ToString() + " vaccinations pending";
                    }
                    else
                    {
                        vaccinationsAlert.Text = vaccineList.Count.ToString() + " vacunas pendientes";
                    }
                }
                childBirthday.Text = CurrentChild.Birthday.ToString();

                /*
                 * if (CurrentContext.CurrentUnits.DistanceUnits == DistanceUnits.CM)
                 * {
                 *  weightMeasurement.Text = maxDateofWeight == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofWeight, MeasurementType.WEIGHT).Value.ToString() + " oz";
                 *  heightMeasurement.Text = maxDateofHeight == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofHeight, MeasurementType.HEIGHT).Value.ToString() + " cm";
                 *  headCircumferenceMeasurement.Text = maxDateofHead == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofHead, MeasurementType.HEAD_CIRCUMFERENCE).Value.ToString() + " cm";
                 * }
                 * else
                 * {
                 */
                weightMeasurement.Text            = maxDateofWeight == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofWeight, MeasurementType.WEIGHT).Value.ToString() + " lbs";
                heightMeasurement.Text            = maxDateofHeight == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofHeight, MeasurementType.HEIGHT).Value.ToString() + " in";
                headCircumferenceMeasurement.Text = maxDateofHead == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofHead, MeasurementType.HEAD_CIRCUMFERENCE).Value.ToString() + " in";

                childBirthday.Text = CurrentChild.Birthday.ToString();

                // Update weights
                weightMeasurement.Text            = maxDateofWeight == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofWeight, MeasurementType.WEIGHT).Value.ToString() + " oz";
                heightMeasurement.Text            = maxDateofHeight == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofHeight, MeasurementType.HEIGHT).Value.ToString() + " cm";
                headCircumferenceMeasurement.Text = maxDateofHead == DateTime.MinValue ? "NaN" : CurrentChild.GetMeasurementForDateAndType(maxDateofHead, MeasurementType.HEAD_CIRCUMFERENCE).Value.ToString() + " cm";

                Dictionary <Models.MilestoneCategory, List <MilestoneWithResponse> > milestonesPercDict = CurrentChild.GetMilestoneHistory();

                List <MilestoneWithResponse> socialMilestones;
                List <MilestoneWithResponse> cognitiveMilestones;
                List <MilestoneWithResponse> commMilestones;
                List <MilestoneWithResponse> movementMilestones;

                milestonesPercDict.TryGetValue(Models.MilestoneCategory.SOCIAL_AND_EMOTIONAL, out socialMilestones);
                milestonesPercDict.TryGetValue(Models.MilestoneCategory.COGNITIVE, out cognitiveMilestones);
                milestonesPercDict.TryGetValue(Models.MilestoneCategory.COMMUNICATION, out commMilestones);
                milestonesPercDict.TryGetValue(Models.MilestoneCategory.MOVEMENT, out movementMilestones);

                emotionalAndSocial.Text   = returnMilestonesPerc(socialMilestones).ToString() + "%";
                physicalGrowth.Text       = returnMilestonesPerc(movementMilestones).ToString() + "%";
                LanguageDevelopment.Text  = returnMilestonesPerc(commMilestones).ToString() + "%";
                ThinkingAndReasoning.Text = returnMilestonesPerc(cognitiveMilestones).ToString() + "%";

                progressBar1.Progress = CurrentChild.GetVaccinationCompletionPercentage();

                listView1.ItemsSource = warning;
                TimeSpan diff = DateTime.Today.Date - CurrentChild.Birthday.Date;
                if (diff.Days < 365 * 3 && diff.Days > 0)
                {
                    warning.Clear();
                    findWarnings();
                }

                if (warning.Count == 0)
                {
                    warning.Add(new Warning {
                        WarningName = "No Warnings to show"
                    });
                }
            }
        }