示例#1
0
 public PrivateChat(Dictionary <string, PrivateChat> chatWindowDictionary, string toUsername, ClientManager manager)
 {
     InitializeComponent();
     windowDictionary = chatWindowDictionary;
     windowUsername   = toUsername;
     cliManager       = manager;
     fromUsername     = manager.Username;
 }
示例#2
0
文件: MainForm.cs 项目: Jaex/Chat
        private void ClientConnect()
        {
            if (!string.IsNullOrEmpty(txtClientIP.Text) && nudClientPort.Value > 0 && !string.IsNullOrEmpty(txtClientNickname.Text))
            {
                client = new ClientManager(txtClientIP.Text, (int)nudClientPort.Value, txtClientNickname.Text);
                client.Connect(txtClientPassword.Text);

                if (client != null && client.IsConnected)
                {
                    client.Notification += client_Notification;
                    client.MessageReceived += client_MessageReceived;
                    client.UserConnected += client_UserConnected;
                    client.UserDisconnected += client_UserDisconnected;
                    client.UserListReceived += client_UserListReceived;
                    client.Kicked += client_Kicked;
                    client.Pong += client_Pong;

                    ClientConnected = true;
                }
            }
        }