Esempio n. 1
0
 private void BeginTryToConnectParticipant(Participant participant, string nickname)
 {
     participant.BeginSend(new Message(nickname), () =>
     {
         participant.BeginReceive(OnMessage, exception => { throw exception; });
     }, OnError);
 }
Esempio n. 2
0
 private static void BroadcastMessage(Participant participant)
 {
     participant.BeginReceive(messageReceived =>
     {
         room.Broadcast(new Message(participant.Nickname + ": " + messageReceived));
         BroadcastMessage(participant);
     }, OnError);
 }
Esempio 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);
            }
        }
Esempio 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);
 }
Esempio n. 5
0
 private static void TryToReceive(Participant participant)
 {
     participant.BeginReceive(OnReceiveMessage, OnError);
 }