private async void SendFakeAmberAlert(string device, AmberAlertMSG payload) { string command = "amber_alert"; string output = JsonConvert.SerializeObject(payload); txtLogbox.AppendText("This will attempt to activate LightBeacons via the DisplayBeacon as a proxy." + Environment.NewLine); var remoteCommand = new CloudToDeviceMethod(command) { ResponseTimeout = TimeSpan.FromSeconds(30) }; remoteCommand.SetPayloadJson(output); CloudToDeviceMethodResult response = new CloudToDeviceMethodResult(); try { response = await serviceClient.InvokeDeviceMethodAsync(lstDevices.SelectedValue.ToString(), remoteCommand); } catch (Exception ex) { txtLogbox.AppendText(ex.Message + Environment.NewLine); } txtLogbox.AppendText(response.GetPayloadAsJson() + Environment.NewLine); }
private void button8_Click(object sender, EventArgs e) { AmberAlertMSG testPayload = new AmberAlertMSG(); SendFakeAmberAlert(lstDevices.SelectedValue.ToString(), testPayload); }