async void QueryRisk() { ProcessingApiCall = ProcessState.RUNNING; string risk = await NetworkLayer.GetRisk(); if (risk == null) { risk = LocResources.Unknown; } ProcessingApiCall = ProcessState.IDLE; OnRiskResult(this, risk); }
public static async Task <string> RetrieveId(bool force = false) { string id = Preferences.Get(AppConfiguration.PREF_ID, null); if (force || id == null) { id = await NetworkLayer.RegisterAndGetId(); Preferences.Set(AppConfiguration.PREF_ID, id); } return(id); }
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); }
private async void SendDataToServer() { // Before sending, make sure we have an Id. Do not send if we can't retrieve it DeviceLocationsBundle.id = await RetrieveId(); if (DeviceLocationsBundle.id == null) { return; } string data = JsonConvert.SerializeObject(DeviceLocationsBundle); bool success = await NetworkLayer.SendDataToServer(data); if (success) { DeviceLocationsBundle.ClearLocations(); } }