Ejemplo n.º 1
0
        async void ReportSymptoms()
        {
            Symptoms symptoms = new Symptoms();

            foreach (Symptom symptom in TestsList)
            {
                typeof(Symptoms).GetField(symptom.Id).SetValue(symptoms, symptom.IsChecked);
            }
            foreach (Symptom symptom in SymptomsList)
            {
                typeof(Symptoms).GetField(symptom.Id).SetValue(symptoms, symptom.IsChecked);
            }

            ProcessingApiCall = ProcessState.RUNNING;
            bool success = await SendSymptoms(symptoms);

            ProcessingApiCall = ProcessState.IDLE;

            if (success)
            {
                OnPageExit(this, Status.Success);
            }
            else
            {
                OnPageExit(this, Status.Error);
            }
        }
Ejemplo n.º 2
0
        private async Task <bool> SendSymptoms(Symptoms symptoms)
        {
            Report report = new Report(symptoms);

            report.id = await LocationsAggregator.RetrieveId();

            if (report.id == null)
            {
                return(false);
            }

            string data    = JsonConvert.SerializeObject(report);
            bool   success = await NetworkLayer.SendDataToServer(data);

            return(success);
        }
Ejemplo n.º 3
0
 public Report(Symptoms symptoms)
 {
     this.timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
     this.symptoms  = symptoms;
 }