Exemplo n.º 1
0
        private async Task <bool> GetPrecipitationData()
        {
            PrecipitationDto dto = await precipitation.GetPrecipitation();

            FindViewById <TextView>(Resource.Id.resultJsonText).Text = wind.ReturnedJsonString;
            if (dto == null)
            {
                FindViewById <TextView>(Resource.Id.stationNameText).Text = "GetPrecipitation returned null.";
                return(false);
            }
            else
            {
                FindViewById <TextView>(Resource.Id.precipitationTypeText).Text      = dto.PtStr;
                FindViewById <TextView>(Resource.Id.precipitationIntensityText).Text = dto.Pi.ToUiDashes3();
                FindViewById <TextView>(Resource.Id.precipitationQuantityText).Text  = dto.Pq.ToUiDashes3();
                return(true);
            }
        }
Exemplo n.º 2
0
        public async Task <PrecipitationDto> GetPrecipitation()
        {
            string queryString = GetLatestUrl();
            var    results     = await DataService.GetDataFromService(queryString).ConfigureAwait(false);

            ReturnedJsonString = results.ToString();

            // {"pid":54623,"papon":"2016-11-19T06:14:44.083Z",
            // "pcon":"2016-11-19T06:14:44.080Z",
            // "pdon":null,"ptStr":"UNKNOWN",
            // "psid":"7fc30138-9d5c-e511-80cc-008cfa5abd0b",
            // "pts":null,"papa":1,
            // "pdt":"2016-11-19T06:14:44.003Z","pt":-1,
            // "pq":null,"pi":null,"erh":null,"edp":null,"eap":null}
            if (results != null)
            {
                PrecipitationDto dto = new PrecipitationDto();
                dto.Pid   = (int)results["pid"];
                dto.Papon = (DateTime?)results["papon"];
                dto.Pcon  = (DateTime?)results["pcon"];
                dto.Pdon  = (DateTime?)results["pdon"];

                dto.Pdt   = (DateTime)results["pdt"];
                dto.Pt    = (short?)results["pt"];
                dto.PtStr = (string)results["ptStr"];
                dto.Pq    = (short?)results["pq"];
                dto.Pi    = (short?)results["pi"];
                dto.Erh   = (float?)results["erh"];
                dto.Edp   = (float?)results["edp"];
                dto.Eap   = (float?)results["eap"];

                dto.Psid = (Guid)results["psid"];
                dto.Pts  = (DateTime?)results["pts"];
                dto.Papa = (int)results["papa"];

                return(dto);
            }

            return(null);
        }