Exemplo n.º 1
0
        private async void FanOutCardToClient(ClientModel client, MothershipSendCardMessage message)
        {
            try
            {
                // Send it to the client
                await client.SendCardAsync(message);

                try
                {
                    // And then let the mothership know it was received
                    Send(new MothershipClientReceivedCardMessage()
                    {
                        CardIdentifier = message.CardIdentifier,
                        ClientName     = client.Name
                    });
                }
                catch { }
            }
            catch (Exception ex)
            {
                // Let mothership know it failed to send
                try
                {
                    Send(new MothershipFailedToSendCardToClientMessage()
                    {
                        ClientName     = client.Name,
                        CardIdentifier = message.CardIdentifier,
                        ErrorText      = ex.Message
                    });
                }
                catch { }
            }
        }
Exemplo n.º 2
0
 private void FanOutCard(MothershipSendCardMessage message)
 {
     lock (Clients)
     {
         foreach (var c in Clients)
         {
             FanOutCardToClient(c, message);
         }
     }
 }
 public Task SendCardAsync(MothershipSendCardMessage message)
 {
     return(SendAsync(message));
 }