Skip to content

Instantly share code, notes, and snippets.

@DevJohnC
Created September 11, 2013 22:41
Show Gist options
  • Select an option

  • Save DevJohnC/6530780 to your computer and use it in GitHub Desktop.

Select an option

Save DevJohnC/6530780 to your computer and use it in GitHub Desktop.
private void ShutdownComputer(IDevice computer, ISecurityCredentials credentials)
{
ServiceHelper.Call<ShutdownResponse>(computer, new Shutdown(), credentials, (shutdownResponse, exception) =>
{
if (exception is API.Exceptions.PermissionDeniedException)
{
// pincode required for call, prompt user for it in full version
if (credentials == null)
{
var dummyCredentials = new API.Security.PinCode
{
Code = "1234",
CodeId = "56",
UserId = Guid.NewGuid()
};
ShutdownComputer(computer, dummyCredentials);
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment