public void CopyTo(HumidityTemperatureData datatocopy) { MeasuredAt = datatocopy.MeasuredAt; Humidity = datatocopy.Humidity; Temperature = datatocopy.Temperature; IsValid = true; }
private async void OnTimerTick(object state) { var r = new Random(); if (oneShotOnly) { samplingTimer.Change(Timeout.Infinite, Timeout.Infinite); await this.dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { SamplingCommandText = "Measure temperature"; }); isRunning = false; } await this.dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { CurrentDateTime = DateTime.Now; CurrentTemperature = r.Next(10, 30); CurrentHumidity = r.Next(10, 90); }); HumidityTemperatureData htd = new HumidityTemperatureData(CurrentHumidity, CurrentTemperature, CurrentDateTime, true); // await AzureIoTHub.SendDeviceToCloudMessageAsync(htd.Serialize_to_JSon()); }