protected internal void View_NavigatedCore(object sender, Windows.UI.Xaml.Navigation.NavigationEventArgs e) { if (e != null) { if (CurrentChild != null) { CurrentChild.InvokeOnNavigatedFrom(e); CurrentChild.Cleanup(); CurrentChild = null; } MemoryCheck(); Type key = e.Content.GetType(); var child = Children[key]; var element = e.Content as FrameworkElement; child.Parent = this; child.ViewBase = element; CurrentChild = child; child.Initialize(); child.InvokeOnNavigatedTo(e); } }
protected void View_Navigating(object sender, Windows.UI.Xaml.Navigation.NavigatingCancelEventArgs e) { if (CurrentChild != null) { CurrentChild.InvokeOnNavigatingFrom(e); } }
protected void View_NavigatingCore(object sender, NavigatingCancelEventArgs e) { if (CurrentChild != null) { CurrentChild.InvokeOnNavigatingFrom(e); } }
protected internal void View_NavigatedCore(object sender, NavigationEventArgs e) { try { if (e != null) { if (CurrentChild != null) { CurrentChild.InvokeOnNavigatedFrom(e); CurrentChild.Cleanup(); CurrentChild = null; } MemoryCheck(); Type key = e.Content.GetType(); var child = Children[key]; var element = e.Content as FrameworkElement; child.Parent = this; child.ViewBase = element; CurrentChild = child; child.Initialize(); child.InvokeOnNavigatedTo(e); } } catch (Exception ex) { throw new IOException(null, ex); } }
protected void View_NavigationProgress(object sender, NavigationProgressEventArgs e) { if (CurrentChild != null) { CurrentChild.InvokeOnNavigatingProgress(e); } }
/// <summary> /// クリーンアップ /// </summary> public override void Cleanup() { if (CurrentChild != null) { CurrentChild.Cleanup(); CurrentChild = null; } base.Cleanup(); }
async void updateProgBar() { if (CurrentChild != null) { await vacProg.ProgressTo(CurrentChild.GetVaccinationCompletionPercentage(), 250, Easing.Linear); } else { await vacProg.ProgressTo(0, 250, Easing.Linear); } if (CurrentContext == null) { } }
void UpdateVaccineList() { Device.BeginInvokeOnMainThread(() => { if (CurrentChild != null) { Vaccines = CurrentChild.GetListOfDueVaccines(); HistoricalVaccines = CurrentChild.GetVaccineHistory(); initializeVaccinations(); } else { Vaccines = new List <Vaccine>(); HistoricalVaccines = new List <Vaccine>(); initializeVaccinations(); } }); }
public void RotateThemTiles(BaseTile TileToExclude) { foreach (Transform CurrentChild in CurrentLevel.transform) { if (CurrentChild.GetComponent <BaseTile>() && CurrentChild.GetComponent <BaseTile>().GetTileRole() == TileRoles.Rotating && CurrentChild.gameObject != TileToExclude.gameObject) { if (CurrentChild.GetComponent <BaseTile>().ThisTileRotation == TileRotation.Clockwise) { QueueNewRotation(RotateTileSo.Clockwise, TileRotationReason.Remote, CurrentChild.GetComponent <BaseTile>()); } else { QueueNewRotation(RotateTileSo.AntiClockwise, TileRotationReason.Remote, CurrentChild.GetComponent <BaseTile>()); } } } }
protected override Status OnUpdate(float dt) { // Keep going until a child behavior says its running while (true) { var status = CurrentChild.Execute(dt); if (status != Status.Success) { return(status); } // If we have reached the end of the collection if (!this.ChildrenEnumerator.MoveNext()) { return(Status.Success); } // Otherwise keep going CurrentChild = this.ChildrenEnumerator.Current; } }
public void UngroupTiles(BaseTile ParentTile) { List <GameObject> AllGrouped = new List <GameObject>(); foreach (Transform CurrentChild in ParentTile.transform) { if (CurrentChild.GetComponent <BaseTile>()) { AllGrouped.Add(CurrentChild.gameObject); } } foreach (GameObject CurrTile in AllGrouped) { CurrTile.transform.parent = ParentTile.transform.parent; CurrTile.GetComponent <BaseTile>().ShadowParented(false); CurrTile.GetComponent <BaseTile>().RealignAxles(); } BindPositionToTile(false); }
protected void ProcessChildNodeSequence(bool result_on_stop) { if (++_index < Children.Count) { if (State == NodeState.STOPPING) { // Stopped manually //OnStopped.Invoke(false); StopNode(false); } else { // Run next child in sequence // Children[m_index].StartNode(); CurrentChild.StartNode(); } } else { // Finished running all children // OnStopped.Invoke(result_on_stop); StopNode(result_on_stop); } }
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" }); } } }
protected void View_NavigationFailed(object sender, NavigationFailedEventArgs e) { CurrentChild.InvokeOnNavigationFailed(e); }
async Task OnMeasurementClicked(MeasurementType measurementType) { CurrentMeasurementType = measurementType; String measurementTitle = MeasurementEnums.MeasurementTypeAsString(measurementType, CurrentContext.CurrentLanguage); viewModel.ChartTitle = measurementTitle; GrowthChart.Text = measurementTitle; try { viewModel.InputData.Clear(); } catch (Exception e) { // Changing children and reverting to this page causes a crash. viewModel = new ViewModel(); viewModel.ChartTitle = measurementTitle; } if (CurrentChild == null) { return; } GrowthChart.Text = measurementTitle; viewModel.InputData.Clear(); if (CurrentChild == null) { if (CurrentContext.CurrentLanguage == Language.ENGLISH) { await DisplayAlert("Error", "Please select a child", "OK"); return; } else { await DisplayAlert("Error", "Porfavor seleccione un niño", "OK"); return; } } List <Points> points = CurrentChild.GetSortedMeasurementListByType(measurementType); if (points == null) { CurrentChild.AddMeasurementForDateAndType(CurrentChild.Birthday, MeasurementType.HEIGHT, CurrentContext.CurrentUnits, 0.0); CurrentChild.AddMeasurementForDateAndType(CurrentChild.Birthday, MeasurementType.WEIGHT, CurrentContext.CurrentUnits, 0.0); CurrentChild.AddMeasurementForDateAndType(CurrentChild.Birthday, MeasurementType.HEAD_CIRCUMFERENCE, CurrentContext.CurrentUnits, 0.0); return; } foreach (Points pt in points) { viewModel.InputData.Add(pt); } viewModel.LineData3.Clear(); viewModel.LineData5.Clear(); viewModel.LineData10.Clear(); viewModel.LineData25.Clear(); viewModel.LineData50.Clear(); viewModel.LineData75.Clear(); viewModel.LineData90.Clear(); WHOData measurementData = new WHOData(); Dictionary <WHOData.Percentile, List <double> > measurementsByGender; List <Double> measurementList3; List <Double> measurementList5; List <Double> measurementList10; List <Double> measurementList25; List <Double> measurementList50; List <Double> measurementList75; List <Double> measurementList90; // Find list of measurements for measurement type and gender. TODO: Change this based on preferred units. switch (measurementType) { case MeasurementType.WEIGHT: measurementData.weightPercentile.TryGetValue(WHOData.AdaptChildGender(CurrentChild.ChildGender), out measurementsByGender); break; case MeasurementType.HEIGHT: measurementData.heightPercentile.TryGetValue(WHOData.AdaptChildGender(CurrentChild.ChildGender), out measurementsByGender); break; case MeasurementType.HEAD_CIRCUMFERENCE: measurementData.headPercentile.TryGetValue(WHOData.AdaptChildGender(CurrentChild.ChildGender), out measurementsByGender); break; default: measurementData.weightPercentile.TryGetValue(WHOData.AdaptChildGender(CurrentChild.ChildGender), out measurementsByGender); break; } measurementsByGender.TryGetValue(WHOData.Percentile.P3, out measurementList3); measurementsByGender.TryGetValue(WHOData.Percentile.P5, out measurementList5); measurementsByGender.TryGetValue(WHOData.Percentile.P10, out measurementList10); measurementsByGender.TryGetValue(WHOData.Percentile.P25, out measurementList25); measurementsByGender.TryGetValue(WHOData.Percentile.P50, out measurementList50); measurementsByGender.TryGetValue(WHOData.Percentile.P75, out measurementList75); measurementsByGender.TryGetValue(WHOData.Percentile.P90, out measurementList90); for (int i = 0; i < measurementData.ageList.Count(); i++) { viewModel.LineData3.Add(new Points(measurementData.ageList[i], measurementList3[i])); viewModel.LineData5.Add(new Points(measurementData.ageList[i], measurementList5[i])); viewModel.LineData10.Add(new Points(measurementData.ageList[i], measurementList10[i])); viewModel.LineData25.Add(new Points(measurementData.ageList[i], measurementList25[i])); viewModel.LineData50.Add(new Points(measurementData.ageList[i], measurementList50[i])); viewModel.LineData75.Add(new Points(measurementData.ageList[i], measurementList75[i])); viewModel.LineData90.Add(new Points(measurementData.ageList[i], measurementList90[i])); } }
/// <summary> /// Submit Height, Weight, and HeadC /// </summary> async void OnSubmitClicked(object sender, EventArgs args) { Double Height = DEFAULT_MEASUREMENT_VALUE; Double Weight = DEFAULT_MEASUREMENT_VALUE; Double HeadC = DEFAULT_MEASUREMENT_VALUE; try { Height = Double.Parse(HeightEntry.Text); } catch { } try { Weight = Double.Parse(WeightEntry.Text); } catch { } try { HeadC = Double.Parse(HeadEntry.Text); } catch { } Button button = (Button)sender; //TODO STEFAN: Replace this with an await call to SQLite ChildDatabaseAccess childDatabase = new ChildDatabaseAccess(); DateTime selectedDate = GetSelectedDate(); Units currentUnits = GetCurrentUnits(); if (CurrentChild != null) { try { if (DEFAULT_MEASUREMENT_VALUE != Height) { CurrentChild.AddMeasurementForDateAndType(selectedDate, MeasurementType.HEIGHT, currentUnits, Height); } if (DEFAULT_MEASUREMENT_VALUE != Weight) { CurrentChild.AddMeasurementForDateAndType(selectedDate, MeasurementType.WEIGHT, currentUnits, Weight); } if (DEFAULT_MEASUREMENT_VALUE != HeadC) { CurrentChild.AddMeasurementForDateAndType(selectedDate, MeasurementType.HEAD_CIRCUMFERENCE, currentUnits, HeadC); } UpdateSelectedMeasurements(); } catch (Exception e) { } List <Points> points = _currentChild.GetSortedMeasurementListByType(MeasurementType.WEIGHT); if (points == null) { _currentChild.AddMeasurementForDateAndType(_currentChild.Birthday, MeasurementType.WEIGHT, CurrentContext.CurrentUnits, 0.0); return; } foreach (Points pt in points) { viewModel.InputData.Add(pt); } } }
void findWarnings() { warning.Clear(); //Measurement Anonamlies 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(); // Update weights double wt = maxDateofWeight == DateTime.MinValue ? -1 : CurrentChild.GetMeasurementForDateAndType(maxDateofWeight, MeasurementType.WEIGHT).Value; double ht = maxDateofHeight == DateTime.MinValue ? -1 : CurrentChild.GetMeasurementForDateAndType(maxDateofHeight, MeasurementType.HEIGHT).Value; double hd = maxDateofHead == DateTime.MinValue ? -1 : CurrentChild.GetMeasurementForDateAndType(maxDateofHead, MeasurementType.HEAD_CIRCUMFERENCE).Value; WHOData data = new WHOData(); if (wt != -1) { Tuple <double, double> acceptable = acceptableRange(data.weightPercentile); if (wt < acceptable.Item1) { if (CurrentContext.CurrentLanguage == Language.ENGLISH) { warning.Add(new Warning { WarningName = CurrentChild.Name + " " + "is under the 5th percentile in weight" }); } else { warning.Add(new Warning { WarningName = CurrentChild.Name + " " + "está bajo el 5 por ciento en peso" }); } } if (wt > acceptable.Item2) { if (CurrentContext.CurrentLanguage == Language.ENGLISH) { warning.Add(new Warning { WarningName = CurrentChild.Name + " " + "is over the 95th percentile in weight" }); } else { warning.Add(new Warning { WarningName = CurrentChild.Name + " " + "está sobre el 95 por ciento en peso" }); } } } if (ht != -1) { Tuple <double, double> acceptable = acceptableRange(data.heightPercentile); if (ht < acceptable.Item1) { if (CurrentContext.CurrentLanguage == Language.ENGLISH) { warning.Add(new Warning { WarningName = CurrentChild.Name + " " + "is under the 5th percentile in height" }); } else { warning.Add(new Warning { WarningName = CurrentChild.Name + " " + "está bajo el 5 por ciento en estatura" }); } } } if (hd != -1) { Tuple <double, double> acceptable = acceptableRange(data.headPercentile); if (hd < acceptable.Item1) { if (CurrentContext.CurrentLanguage == Language.ENGLISH) { warning.Add(new Warning { WarningName = CurrentChild.Name + " " + "is under the 5th percentile in head circumference" }); } else { warning.Add(new Warning { WarningName = CurrentChild.Name + " " + "está bajo el 5 por ciento en circunferencia de cabeza" }); } } if (hd > acceptable.Item2) { if (CurrentContext.CurrentLanguage == Language.ENGLISH) { warning.Add(new Warning { WarningName = CurrentChild.Name + " " + "is over the 95th percentile in head circumference" }); } else { warning.Add(new Warning { WarningName = CurrentChild.Name + " " + "está sobre el 95 por ciento en circunferencia de cabeza" }); } } } }
protected void View_NavigationStopped(object sender, Windows.UI.Xaml.Navigation.NavigationEventArgs e) { CurrentChild.InvokeOnNavigationStopped(e); }