Ejemplo n.º 1
0
        public async Task ProcessMeteoByCoordinatesToday(string url, string fileName)
        {
            var jsonStr = await(Client.GetStringAsync(url));
            var jsonObj = JsonConvert.DeserializeObject <MeasureForToday>(jsonStr);

            PrintDataForToday.PrintForData(jsonObj);
            System.IO.File.WriteAllText(fileName, jsonStr);
        }
Ejemplo n.º 2
0
        public async Task ProcessMeteoByPlaceToday(string url, string fileName)
        {
            var jsonStr = await(Client.GetStringAsync(url));
            var jsonObj = JsonConvert.DeserializeObject <MeasureForToday>(jsonStr);

            PrintDataForToday.PrintForData(jsonObj);
            var firstValueHeader = jsonObj.main.GetType().GetProperties();

            //Console.WriteLine(t);
            for (var i = 0; i < firstValueHeader.Length; i++)
            {
                var valueWithoutSplit = firstValueHeader.GetValue(i);
                var valueForHeader    = Convert.ToString(valueWithoutSplit).Split(' ')[1]; // Nome campi Header
            }
            System.IO.File.WriteAllText(fileName, jsonStr);                                // creazione file;
        }