// All {} and %% in the Attribute have been resolved by now. private Twin BuildItemFromAttr(IoTGetDeviceTwinAttribute attribute) { string deviceId = attribute.DeviceId; GetDeviceTwinAsync(attribute).Wait(); return(deviceTwin); }
private async Task GetDeviceTwinAsync(IoTGetDeviceTwinAttribute attribute) { if (registryManager == null) { connectionString = attribute.Connection; registryManager = RegistryManager.CreateFromConnectionString(connectionString); } deviceTwin = await registryManager.GetTwinAsync(attribute.DeviceId); }
private async Task GetDeviceTwinAsync(IoTGetDeviceTwinAttribute attribute) { var connectionString = attribute.Connection; RegistryManager registryManager = null; if (!_manager.TryGetValue(connectionString, out registryManager)) { registryManager = RegistryManager.CreateFromConnectionString(connectionString); _manager.Add(connectionString, registryManager); } deviceTwin = await registryManager.GetTwinAsync(attribute.DeviceId); }