Exemplo n.º 1
0
        private async void UpdatePlotWithServerData()
        {
            string responseText = await Server.GETData();

            try
            {
                var responseJson = await GetResponseCollection(responseText);

                UpdateCharts(timeStamp / 1000.0, responseJson.Find(item => item.Name == "Temperature").Value, responseJson.Find(item => item.Name == "Humidity").Value, responseJson.Find(item => item.Name == "Pressure").Value);
            }
            catch (Exception e)
            {
                Debug.WriteLine("JSON DATA ERROR");
                Debug.WriteLine(responseText);
                Debug.WriteLine(e);
            }
            timeStamp += Config.SampleTime;
        }
        private async void RequestTimerElaped(object sender, ElapsedEventArgs e)
        {
            string responseText = await _server.GETData();

            // Debug.WriteLine(responseText);

            try
            {
                var responseJson = await GetResponseCollection(responseText);

                DataList = new ObservableCollection <SensorDataModel>(responseJson);
            }
            catch (Exception exc)
            {
                Debug.WriteLine("Json parsing error: ");
                Debug.WriteLine(exc);
            }
        }