Skip to content

Instantly share code, notes, and snippets.

@ztirom
Created April 22, 2016 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ztirom/9858a6022b0af134fcd9e51854fa8dac to your computer and use it in GitHub Desktop.
Save ztirom/9858a6022b0af134fcd9e51854fa8dac to your computer and use it in GitHub Desktop.
FirstStepsWithAzureIoTHub
public async static Task AddDeviceAsync(string deviceId) {
regManager = RegistryManager.CreateFromConnectionString(IOTHUBSTRING);
try
{
device = await regManager.AddDeviceAsync(new Device(deviceId));
}
catch (DeviceAlreadyExistsException)
{
device = await regManager.GetDeviceAsync(deviceId);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment