public static int CalcCountDownValue(MedicineWithDoses medicine) { if (medicine == null) return 0; var previousDoseTime = medicine.PreviousDoseTime; var nextDoseTime = medicine.NextDoseTime; var totalTime = TimeOfDayHelper.GetTimeBetween(previousDoseTime, nextDoseTime); var remainingTime = TimeOfDayHelper.GetTimeOffsetForNextPill(medicine.NextDoseTime); var countDown = ((int)remainingTime.TotalMinutes * 100) / (int)totalTime.TotalMinutes; return countDown > CountDownMaxValue ? CountDownMaxValue : countDown; }
void UpdateCurrentMedicine (MedicineWithDoses medicine) { CurrentMedicine = medicine; FirstMedicineSelected = _firstMedicine == medicine; }