Skip to content

Instantly share code, notes, and snippets.

@melzoghbi
Last active April 20, 2018 18:36
Show Gist options
  • Save melzoghbi/b8fc16593048e1959e6459c78c3581a6 to your computer and use it in GitHub Desktop.
Save melzoghbi/b8fc16593048e1959e6459c78c3581a6 to your computer and use it in GitHub Desktop.
Sample File
static Task onDesiredPropertiesUpdate(TwinCollection desiredProperties, object userContext)
{
try
{
Console.WriteLine("Desired property change:");
Console.WriteLine(JsonConvert.SerializeObject(desiredProperties));
if (desiredProperties["TemperatureThreshold"]!=null)
temperatureThreshold = desiredProperties["TemperatureThreshold"];
}
catch (AggregateException ex)
{
foreach (Exception exception in ex.InnerExceptions)
{
Console.WriteLine();
Console.WriteLine("Error when receiving desired property: {0}", exception);
}
}
catch (Exception ex)
{
Console.WriteLine();
Console.WriteLine("Error when receiving desired property: {0}", ex.Message);
}
return Task.CompletedTask;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment