Ejemplo n.º 1
0
 /// <summary>
 /// Sends a message to ALL connected clients.
 /// </summary>
 /// <param name="command">the message to send</param>
 public async Task BroadcastCommandAsync(LightSwitchCommand command)
 {
     foreach (var client in GetSafeClients())
     {
         await SendLightSwitchCommand(client, command);
     }
 }
Ejemplo n.º 2
0
        private async Task SendLightSwitchCommand(LightSwitchClient lightSwitchClient, LightSwitchCommand lightSwitchCommand)
        {
            var sendCommandResult = await lightSwitchClient.SendCommandAsync(lightSwitchCommand);

            if (sendCommandResult.HasError)
            {
                await Log.ReportErrorAsync(sendCommandResult.Message, CancellationToken);
            }
        }