private void tempValueChanged(object sender, RangeBaseValueChangedEventArgs e) { SendToastNotification(); int newTemp = (int)e.NewValue; HeaterCommand heatercommand = new HeaterCommand(); heatercommand.command = "SetDesiredTemp"; heatercommand.parameterName = "temperature"; heatercommand.parameter = newTemp; String command = JsonConvert.SerializeObject(heatercommand); settemp.Text = "Desired Temp: " + newTemp + "C"; IoTClient.SendEvent(command); }
private void toggleHandler(object sender, RoutedEventArgs e) { SendToastNotification(); //TODO disable receiving new commands while this command gets to device SendToastNotification(); int param = 0; HeaterCommand heatercommand = new HeaterCommand(); string command; if (toggleSwitch.IsOn) { heatercommand.command = "TurnHeaterOn"; } else { heatercommand.command = "TurnHeaterOff"; heatercommand.parameterName = "reason"; heatercommand.parameter = param; } command = JsonConvert.SerializeObject(heatercommand); IoTClient.SendEvent(command); }