Example #1
0
        private void PopulateChart(DeviceDataCollection newValue)
        {
            chart.Series[0].ItemsSource = newValue;
            var axis = chart.Axes.OfType <CategoryXAxis>().First();

            axis.ItemsSource = newValue;
        }
        public bool GetData()
        {
            //IsBusy = true;
            new CloudantDataService ().GetDeviceData ().ContinueWith((d)=> {
                Data = d.Result;

                //IsBusy = false;
            });

            return true;
        }
Example #3
0
        public bool GetData()
        {
            //IsBusy = true;
            new CloudantDataService().GetDeviceData().ContinueWith((d) => {
                Data = d.Result;

                //IsBusy = false;
            });

            return(true);
        }
        private async Task <DeviceDataCollection> HandleResponse(string data)
        {
            return(await Task.Run(() => {
                var cloudantData = JsonConvert.DeserializeObject <CloudantData> (data);
                if (cloudantData == null)
                {
                    return null;
                }

                var deviceDataCollection = new DeviceDataCollection();
                foreach (var item in cloudantData.Rows)
                {
                    item.Doc.DeviceData.Timestamp = item.Doc.DeviceData.Timestamp.ToLocalTime();
                    deviceDataCollection.Add(item.Doc.DeviceData);
                }

                return deviceDataCollection;
            }));
        }
		private async Task<DeviceDataCollection> HandleResponse(string data)
		{
			return await Task.Run (()=>{

				var cloudantData = JsonConvert.DeserializeObject<CloudantData> (data);
				if (cloudantData == null) {
					return null;
				}

				var deviceDataCollection = new DeviceDataCollection ();
				foreach (var item in cloudantData.Rows) {
					item.Doc.DeviceData.Timestamp = item.Doc.DeviceData.Timestamp.ToLocalTime();
					deviceDataCollection.Add (item.Doc.DeviceData);
				}

				return deviceDataCollection;
			});

		}
        public async Task <DeviceDataCollection> GetDeviceData()
        {
            return(await Task.Run(() =>
            {
                var deviceDataCol = new DeviceDataCollection();

                var csv = DataProvider.GetResourceCsvFileData(@"BluemixIoT.Data.air_quality.csv");
                for (var i = 1; i < csv.Rows.Count; i++)
                {
                    var data = csv[i, "d"];
                    var deviceData = new DeviceData
                    {
                        Id = csv[i, "_id"],
                        Data = JsonConvert.DeserializeObject <AirQuality>(csv[i, "d"]),
                        Timestamp = Convert.ToDateTime(csv[i, "ts"]),
                    };
                    deviceDataCol.Add(deviceData);
                }

                return deviceDataCol;
            }));
        }
		public async Task<DeviceDataCollection> GetDeviceData()
		{
			return await Task.Run(() =>
				{
					var deviceDataCol = new DeviceDataCollection();

					var csv = DataProvider.GetResourceCsvFileData(@"BluemixIoT.Data.air_quality.csv");
					for (var i = 1; i < csv.Rows.Count; i++)
					{
						var data = csv[i, "d"];
						var deviceData = new DeviceData
						{
							Id = csv[i, "_id"],
							Data = JsonConvert.DeserializeObject<AirQuality>(csv[i, "d"]),
							Timestamp = Convert.ToDateTime(csv[i, "ts"]),
						};
						deviceDataCol.Add(deviceData);
					}

					return deviceDataCol;
				});


		}
Example #8
0
 private void PopulateChart(DeviceDataCollection newValue)
 {
     chart.Series[0].ItemsSource = newValue;
     var axis = chart.Axes.OfType<CategoryXAxis>().First();
     axis.ItemsSource = newValue;
 }
Example #9
0
 private static void OnDataChanged(BindableObject bindable, DeviceDataCollection oldvalue, DeviceDataCollection newvalue)
 {
     ((ChartView)bindable).OnDataChanged(oldvalue, newvalue);
 }
Example #10
0
 public void OnDataChanged(DeviceDataCollection oldValue, DeviceDataCollection newValue)
 {
     PopulateChart(newValue);
 }
Example #11
0
 public void OnDataChanged(DeviceDataCollection oldValue, DeviceDataCollection newValue)
 {
     PopulateChart(newValue);
 }
Example #12
0
 private static void OnDataChanged(BindableObject bindable, DeviceDataCollection oldvalue, DeviceDataCollection newvalue)
 {
     ((ChartView)bindable).OnDataChanged(oldvalue, newvalue);
 }