Example #1
0
        private async Task <Record> CreateRecord()
        {
            if (rdbCelcius.IsChecked != null && rdbCelcius.IsChecked.Value)
            {
                temperatureUnit = EnumTemperatureUnit.CELCIUS;
            }
            else if (rdbFahrenheit.IsChecked != null && rdbFahrenheit.IsChecked.Value)
            {
                temperatureUnit = EnumTemperatureUnit.FAHRENHEIT;
            }
            else
            {
                throw new ArgumentException("Invalid Temperature Unit Found");
            }
            temperature = Convert.ToDouble(txtTemperature.Text);
            bpHigh      = Convert.ToDouble(txtBloodPressureHigh.Text);
            bpLow       = Convert.ToDouble(txtBloodPressureLow.Text);
            heartRate   = Convert.ToDouble(txtHeartRate.Text);
            User owner = await GetCurrentUser();

            if (owner == null)
            {
                return(null);
            }
            EnumRiskLevel riskLevel = await CalculateRiskLevel();

            Record record = new Record(owner, riskLevel, temperatureUnit, temperature, bpLow, bpHigh, heartRate, DateTime.Now);

            record.RiskLevel = await CalculateRiskLevel();

            return(record);
        }
Example #2
0
 /// <summary>Initializes a new instance of the Record class.</summary>
 public Record(User owner, EnumRiskLevel riskLevel, EnumTemperatureUnit temperatureUnit, double temperature, double bloodPressureLow, double bloodPressureHigh, double heartRate, DateTime timeTaken)
 {
     this.owner             = owner;
     this.riskLevel         = riskLevel;
     this.temperatureUnit   = temperatureUnit;
     this.temperature       = temperature;
     this.bloodPressureLow  = bloodPressureLow;
     this.bloodPressureHigh = bloodPressureHigh;
     this.heartRate         = heartRate;
     this.timeTaken         = timeTaken;
 }
Example #3
0
 public object Convert(object value, Type targetType, object parameter, string language)
 {
     if (!(value is Record))
     {
         throw new ArgumentException("value to convert must be a Record");
     }
     level = ((Record)value).RiskLevel;
     if (level == EnumRiskLevel.LOW)
     {
         return(new SolidColorBrush(Colors.Green));
     }
     else if (level == EnumRiskLevel.MEDIUM)
     {
         return(new SolidColorBrush(Colors.Yellow));
     }
     else if (level == EnumRiskLevel.HIGH)
     {
         return(new SolidColorBrush(Colors.Red));
     }
     else
     {
         return(new SolidColorBrush(Colors.White));
     }
 }