public AddBloodSugarPageModel(IPluginCollector _pluginCollector, BloodSugarDataPoint point) { Name = "AddBloodSugar"; pluginCollector = _pluginCollector; Time = point.Date.TimeOfDay; Date = point.Date; BloodSugarValue = point.BloodSugarLevel; existingPoint = point; }
public async void on_SelectedIndexChangedBs(object sender, ChartSelectionEventArgs e) { if (e.SelectedSeries != null && e.SelectedDataPointIndex != -1) { if (e.SelectedSeries.Label == "Bloodsugar") { BloodSugarDataPoint bloodPoint = model.SettingsModel.BloodSugarDataPoints[e.SelectedDataPointIndex]; bool action = await DisplayAlert("BloodSugar:", bloodPoint.BloodSugarLevel.ToString(), "Edit", "Back"); if (action == true) { openDataPoint(e.SelectedDataPointIndex, DataPoints.BloodSugar.ToString()); } } if (e.SelectedSeries.Label == "Meal") { MealDataPoint mealPoint = model.SettingsModel.MealDataPoints[e.SelectedDataPointIndex]; string content = ""; content = "Total BreadUnits: " + mealPoint.BreadUnits + "\t\t\t\t" + "Total Energy: " + mealPoint.EnergyAmount + " kcal" + "\n\n"; foreach (Ingredient ing in mealPoint.Ingredients) { content += ing.Name + "\n" + "Breadunits: " + ing.BreadUnits + "\t\t" + "Energy: " + ing.EnergyAmount + "\t\t" + "Amount: " + ing.amount + "\n\n"; } var action = await DisplayAlert("Meal:", content, "Edit", "Back"); if (action == true) { openDataPoint(e.SelectedDataPointIndex, DataPoints.Meal.ToString()); } } if (e.SelectedSeries.Label == "Med") { MedicineDataPoint medPoint = model.SettingsModel.MedicineDataPoints[e.SelectedDataPointIndex]; var action = await DisplayAlert("Medicine:", medPoint.Name + ": " + medPoint.Amount + " " + medPoint.Unit, "Edit", "Back"); if (action == true) { openDataPoint(e.SelectedDataPointIndex, DataPoints.Medicine.ToString()); } } } }
public AddBloodSugarPage(IPluginCollector pluginCollector, BloodSugarDataPoint point) { this.BindingContext = new AddBloodSugarPageModel(pluginCollector, point); InitializeComponent(); }