Ejemplo n.º 1
0
        async void QueryRisk()
        {
            ProcessingApiCall = ProcessState.RUNNING;
            string risk = await NetworkLayer.GetRisk();

            if (risk == null)
            {
                risk = LocResources.Unknown;
            }
            ProcessingApiCall = ProcessState.IDLE;
            OnRiskResult(this, risk);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
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.º 4
0
        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();
            }
        }