コード例 #1
0
 private void DeviceStatusModelToUI(Microsoft.Devices.Management.DeviceInfo deviceInfo)
 {
     DevInfoId.Text                        = deviceInfo.id;
     DevInfoManufacturer.Text              = deviceInfo.manufacturer;
     DevInfoModel.Text                     = deviceInfo.model;
     DevInfoDmVer.Text                     = deviceInfo.dmVer;
     DevInfoLang.Text                      = deviceInfo.lang;
     DevInfoType.Text                      = deviceInfo.type;
     DevInfoOEM.Text                       = deviceInfo.oem;
     DevInfoHwVer.Text                     = deviceInfo.hwVer;
     DevInfoFwVer.Text                     = deviceInfo.fwVer;
     DevInfoOSVer.Text                     = deviceInfo.osVer;
     DevInfoPlatform.Text                  = deviceInfo.platform;
     DevInfoProcessorType.Text             = deviceInfo.processorType;
     DevInfoRadioSwVer.Text                = deviceInfo.radioSwVer;
     DevInfoDisplayResolution.Text         = deviceInfo.displayResolution;
     DevInfoCommercializationOperator.Text = deviceInfo.commercializationOperator;
     DevInfoProcessorArchitecture.Text     = deviceInfo.processorArchitecture;
     DevInfoName.Text                      = deviceInfo.name;
     DevInfoTotalStorage.Text              = deviceInfo.totalStorage;
     DevInfoTotalMemory.Text               = deviceInfo.totalMemory;
     DevInfoSecureBootState.Text           = deviceInfo.secureBootState;
     DevInfoOSEdition.Text                 = deviceInfo.osEdition;
     DevInfoBatteryStatus.Text             = deviceInfo.batteryStatus;
     DevInfoBatteryRemaining.Text          = deviceInfo.batteryRemaining;
     DevInfoBatteryRuntime.Text            = deviceInfo.batteryRuntime;
 }
コード例 #2
0
        private async void ReadDTReported()
        {
            DeviceTwinData deviceTwinData = await _deviceTwin.GetDeviceTwinData();

            Debug.WriteLine("json = " + deviceTwinData.reportedPropertiesJson);

            JObject jsonObject = (JObject)JsonConvert.DeserializeObject(deviceTwinData.reportedPropertiesJson);

            JToken microsoftNode;

            if (!jsonObject.TryGetValue("microsoft", out microsoftNode) || microsoftNode.Type != JTokenType.Object)
            {
                return;
            }
            JObject microsoftObject = (JObject)microsoftNode;

            JToken managementNode;

            if (!microsoftObject.TryGetValue("management", out managementNode) || managementNode.Type != JTokenType.Object)
            {
                return;
            }
            JObject managementObject = (JObject)managementNode;

            foreach (JProperty jsonProp in managementObject.Children())
            {
                if (jsonProp.Name == "timeInfo")
                {
                    Microsoft.Devices.Management.TimeInfo.GetResponse timeInfo = JsonConvert.DeserializeObject <Microsoft.Devices.Management.TimeInfo.GetResponse>(jsonProp.Value.ToString());
                    TimeInfoModelToUI(timeInfo);
                }
                if (jsonProp.Name == "certificates")
                {
                    Microsoft.Devices.Management.Certificates certificatesInfo = JsonConvert.DeserializeObject <Microsoft.Devices.Management.Certificates>(jsonProp.Value.ToString());
                    CertificatesInfoToUI(certificatesInfo);
                }
                else if (jsonProp.Name == "deviceInfo")
                {
                    Microsoft.Devices.Management.DeviceInfo deviceInfo = JsonConvert.DeserializeObject <Microsoft.Devices.Management.DeviceInfo>(jsonProp.Value.ToString());
                    DeviceStatusModelToUI(deviceInfo);
                }
                else if (jsonProp.Name == "rebootInfo")
                {
                    Debug.WriteLine(jsonProp.Value.ToString());
                    var rebootInfo = JsonConvert.DeserializeObject <Microsoft.Devices.Management.RebootInfo.GetResponse>(jsonProp.Value.ToString());
                    RebootInfoModelToUI(rebootInfo);
                }
                else if (jsonProp.Name == "windowsUpdatePolicy")
                {
                    Debug.WriteLine(jsonProp.Value.ToString());
                    var info = JsonConvert.DeserializeObject <Microsoft.Devices.Management.WindowsUpdatePolicyConfiguration>(jsonProp.Value.ToString());
                    WindowsUpdatePolicyConfigurationToUI(info);
                }
                else if (jsonProp.Name == "windowsUpdates")
                {
                    Debug.WriteLine(jsonProp.Value.ToString());
                    var info = JsonConvert.DeserializeObject <Microsoft.Devices.Management.WindowsUpdates.GetResponse>(jsonProp.Value.ToString());
                    WindowsUpdatesConfigurationToUI(info);
                }
            }
        }