public AddMedicinePageModel(IPluginCollector _pluginCollector, MedicineDataPoint point) { Name = "AddMedicine"; pluginCollector = _pluginCollector; Time = point.Date.TimeOfDay; Date = point.Date; MedicineUnits = Enum.GetNames(typeof(MedicineUnits)).ToList(); MedicineUnitIndex = MedicineUnits.ToList().IndexOf(point.Unit); MedicineAmount = point.Amount; MedicineName = point.Name; 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 AddMedicinePage(IPluginCollector pluginCollector, MedicineDataPoint point) { this.BindingContext = new AddMedicinePageModel(pluginCollector, point); InitializeComponent(); }