public async void GetSensoridNew() { //Exception exc = null; string SensorData = ""; using (DeviceInfoService dis = new DeviceInfoService()) { await dis.Initialize(); SensorData += "System ID: " + await dis.ReadSystemId(); SensorData += "Model Nr: " + await dis.ReadModelNumber(); SensorData += "Serial Nr: " + await dis.ReadSerialNumber(); SensorData += "Firmware Revision: " + await dis.ReadFirmwareRevision(); SensorData += "Hardware Revision: " + await dis.ReadHardwareRevision(); SensorData += "Sofware Revision: " + await dis.ReadSoftwareRevision(); SensorData += "Manufacturer Name: " + await dis.ReadManufacturerName(); SensorData += "Cert: " + await dis.ReadCert(); SensorData += "PNP ID: " + await dis.ReadPnpId(); } }
public async Task <string> GetSensorid() { Exception exc = null; string SensorData = ""; try { using (DeviceInfoService dis = new DeviceInfoService()) { await dis.Initialize(); SensorData += "System ID: " + await dis.ReadSystemId(); SensorData += "Model Nr: " + await dis.ReadModelNumber(); SensorData += "Serial Nr: " + await dis.ReadSerialNumber(); SensorData += "Firmware Revision: " + await dis.ReadFirmwareRevision(); SensorData += "Hardware Revision: " + await dis.ReadHardwareRevision(); SensorData += "Sofware Revision: " + await dis.ReadSoftwareRevision(); SensorData += "Manufacturer Name: " + await dis.ReadManufacturerName(); SensorData += "Cert: " + await dis.ReadCert(); SensorData += "PNP ID: " + await dis.ReadPnpId(); } return(SensorData); } catch (Exception ex) { exc = ex; } if (exc != null) { SensorData += exc.Message; } return(SensorData); }
private async void btnGetSysid_Click(object sender, RoutedEventArgs e) { Exception exc = null; try { using (DeviceInfoService dis = new DeviceInfoService()) { await dis.Initialize(); tbSystemId.Text = "System ID: " + await dis.ReadSystemId(); tbModelNr.Text = "Model Nr: " + await dis.ReadModelNumber(); tbSerielNr.Text = "Serial Nr: " + await dis.ReadSerialNumber(); tbFWRev.Text = "Firmware Revision: " + await dis.ReadFirmwareRevision(); tbHWRev.Text = "Hardware Revision: " + await dis.ReadHardwareRevision(); tbSWRev.Text = "Sofware Revision: " + await dis.ReadSoftwareRevision(); tbManufacturerName.Text = "Manufacturer Name: " + await dis.ReadManufacturerName(); tbCert.Text = "Cert: " + await dis.ReadCert(); tbPNP.Text = "PNP ID: " + await dis.ReadPnpId(); } } catch (Exception ex) { exc = ex; } if (exc != null) { await new MessageDialog(exc.Message).ShowAsync(); } }