Exemplo n.º 1
0
 private void BeginTryToConnectParticipant(Participant participant, string nickname)
 {
     participant.BeginSend(new Message(nickname), () =>
     {
         participant.BeginReceive(OnMessage, exception => { throw exception; });
     }, OnError);
 }
Exemplo n.º 2
0
 private static void BroadcastMessage(Participant participant)
 {
     participant.BeginReceive(messageReceived =>
     {
         room.Broadcast(new Message(participant.Nickname + ": " + messageReceived));
         BroadcastMessage(participant);
     }, OnError);
 }
Exemplo n.º 3
0
        private void TryToLogin(string nickname)
        {
            var loginWindow = new LoginWindow(nickname);

            Hide();
            loginWindow.ShowDialog();
            participant = loginWindow.GetParticipant();
            client      = loginWindow.GetClient();
            if (participant == null)
            {
                Application.Current.Shutdown();
            }
            else
            {
                participant.BeginReceive(OnParticipants, OnError);
            }
        }
Exemplo n.º 4
0
 private void BeginReceive(Participant participant)
 {
     participant.BeginReceive(value =>
     {
         string text = value.ToString();
         if (CheckOnlineParticipants(text))
         {
             UpdateOnlineParticipants();
         }
         text = CheckSpecialMessage(text);
         Dispatcher.Invoke(() =>
         {
             messageChatBox.Text += text + "\n";
             messageIssues.Text   = string.Empty;
         });
         BeginReceive(participant);
     }, OnErrorMessageBox);
 }
Exemplo n.º 5
0
 private static void TryToReceive(Participant participant)
 {
     participant.BeginReceive(OnReceiveMessage, OnError);
 }