private async Task ReportRebootCmdStatus(RebootCmdDataContract.ResponseValue status, string rebootCmdTime) { Logger.Log("ReportRebootCmdStatus() invoked.", LoggingLevel.Verbose); RebootCmdDataContract.ReportedProperties reportedProperties = new RebootCmdDataContract.ReportedProperties(status); await _deviceManagementClient.ReportPropertiesAsync(PropertySectionName, reportedProperties.ToJsonObject()); StatusSection statusSection = new StatusSection(StatusSection.StateType.Completed); await _deviceManagementClient.ReportStatusAsync(PropertySectionName, statusSection); }
/// <summary> /// Retrieve the outcome of executing the reboot command from device twin. /// </summary> private async void GetRebootResponseButton_ClickAsync(object sender, RoutedEventArgs e) { var twinResult = await _mainPage.GetTwinData(RebootCmdDataContract.SectionName); if (twinResult != null) { RebootCmdDataContract.ReportedProperties reportedProperties = RebootCmdDataContract.ReportedProperties.FromJsonObject((JObject)twinResult); ReportedResponseText.Text = reportedProperties.response; } }
public void FromJson(JToken json) { if (!(json is JObject)) { System.Windows.MessageBox.Show("Incorrect json format for: " + RebootCmdDataContract.SectionName); return; } JObject jsonObj = (JObject)json; RebootCmdDataContract.ReportedProperties reportedProperties = RebootCmdDataContract.ReportedProperties.FromJsonObject(jsonObj); LastRebootCmdResponse.Text = reportedProperties.response; }