/// <summary> /// Retrieve device info from device twin. /// </summary> private async void UpdateDeviceInfoUIAsync() { var deviceInfoResult = await _mainPage.GetTwinData(DeviceInfoDataContract.SectionName); if (deviceInfoResult != null) { DeviceInfoDataContract.ReportedProperties reportedProperties = DeviceInfoDataContract.ReportedProperties.FromJsonObject((JObject)deviceInfoResult); DeviceId.Text = reportedProperties.id; DeviceManufactuer.Text = reportedProperties.manufacturer; DeviceModel.Text = reportedProperties.model; DeviceDmVer.Text = reportedProperties.dmVer; DeviceLang.Text = reportedProperties.lang; DeviceType.Text = reportedProperties.type; DeviceOEM.Text = reportedProperties.oem; DeviceHwVer.Text = reportedProperties.hwVer; DeviceSwVer.Text = reportedProperties.fwVer; DeviceOsVer.Text = reportedProperties.osVer; DevicePlatform.Text = reportedProperties.platform; DeviceProcessorType.Text = reportedProperties.processorType; DeviceRadioSwVer.Text = reportedProperties.radioSwVer; DeviceDisplayResolution.Text = reportedProperties.displayResolution; DeviceCommercializationOpe.Text = reportedProperties.commercializationOperator; DeviceProcessorArch.Text = reportedProperties.processorArchitecture; DeviceName.Text = reportedProperties.name; DeviceStorage.Text = reportedProperties.totalStorage; DeviceMemory.Text = reportedProperties.totalMemory; DeviceSecureBoot.Text = reportedProperties.secureBootState; DeviceOsEdition.Text = reportedProperties.osEdition; DeviceBatteryStatus.Text = reportedProperties.batteryStatus; DeviceBatteryRemain.Text = reportedProperties.batteryRemaining; DeviceBatteryRuntime.Text = reportedProperties.batteryRuntime; } }
public void FromJsonObject(JObject json) { DeviceInfoDataContract.ReportedProperties reportedProperties = DeviceInfoDataContract.ReportedProperties.FromJsonObject(json); Id.Text = reportedProperties.id; Manufacturer.Text = reportedProperties.manufacturer; Model.Text = reportedProperties.model; DmVer.Text = reportedProperties.dmVer; Lang.Text = reportedProperties.lang; Type.Text = reportedProperties.type; OEM.Text = reportedProperties.oem; HwVer.Text = reportedProperties.hwVer; FwVer.Text = reportedProperties.fwVer; OSVer.Text = reportedProperties.osVer; Platform.Text = reportedProperties.platform; ProcessorType.Text = reportedProperties.processorType; RadioSwVer.Text = reportedProperties.radioSwVer; DisplayResolution.Text = reportedProperties.displayResolution; CommercializationOperator.Text = reportedProperties.commercializationOperator; ProcessorArchitecture.Text = reportedProperties.processorArchitecture; DeviceName.Text = reportedProperties.name; TotalStorage.Text = reportedProperties.totalStorage; TotalMemory.Text = reportedProperties.totalMemory; SecureBootState.Text = reportedProperties.secureBootState; OSEdition.Text = reportedProperties.osEdition; BatteryStatus.Text = reportedProperties.batteryStatus; BatteryRemaining.Text = reportedProperties.batteryRemaining; BatteryRuntime.Text = reportedProperties.batteryRuntime; }
// IClientPropertyHandler public async Task <JObject> GetReportedPropertyAsync() { var request = new Message.GetDeviceInfoRequest(); var response = await _systemConfiguratorProxy.SendCommandAsync(request) as Message.GetDeviceInfoResponse; DeviceInfoDataContract.ReportedProperties reportedProperties = new DeviceInfoDataContract.ReportedProperties(); reportedProperties.batteryRuntime = response.batteryRuntime; reportedProperties.batteryRemaining = response.batteryRemaining; reportedProperties.batteryStatus = response.batteryStatus; reportedProperties.osEdition = response.osEdition; reportedProperties.secureBootState = response.secureBootState; reportedProperties.totalMemory = response.totalMemory; reportedProperties.totalStorage = response.totalStorage; reportedProperties.name = response.name; reportedProperties.processorArchitecture = response.processorArchitecture; reportedProperties.commercializationOperator = response.commercializationOperator; reportedProperties.displayResolution = response.displayResolution; reportedProperties.radioSwVer = response.radioSwVer; reportedProperties.processorType = response.processorType; reportedProperties.platform = response.platform; reportedProperties.osVer = response.osVer; reportedProperties.fwVer = response.fwVer; reportedProperties.hwVer = response.hwVer; reportedProperties.oem = response.oem; reportedProperties.type = response.type; reportedProperties.lang = response.lang; reportedProperties.dmVer = response.dmVer; reportedProperties.model = response.model; reportedProperties.manufacturer = response.manufacturer; reportedProperties.id = response.id; return(reportedProperties.ToJsonObject()); }