Exemplo n.º 1
0
        /// <summary>
        ///	Print messages received and any client or server acks
        /// </summary>
        static void ListenForMessages(Greeter.GreeterClient client, ClientPrompt clientPrompt, string userId)
        {
            while (true)
            {
                // Print received messages
                clientPrompt.PrintReceivedMessage(client.GetFirstUnreadMessage(new GetMessageRequest {
                    RecipientId = userId
                }));

                // Print client acks
                var messageStatusList = client.GetMessageStatus(new GetMessageStatusRequest {
                    SenderId = userId
                }).MessageStatuses;
                if (messageStatusList.Count > 0)
                {
                    foreach (var messageStatus in messageStatusList)
                    {
                        clientPrompt.PrintAck(messageStatus);
                    }
                }

                Thread.Sleep(1500);
            }
        }