예제 #1
0
 public static void statusChangeMessage(StatusChangedEventArgs e)
 {
     messageStatusChangedHandler messageHandler = messageStatusChanged;
     if (messageHandler != null) messageHandler (null, e);
 }
예제 #2
0
        public static void sendMsg(string from, string message)
        {
            StreamWriter sw;
            messageArgs = new StatusChangedEventArgs("0" + from + " " + message);
            statusChangeMessage(messageArgs);

            TcpClient[] clients = new TcpClient[chatServer.users.Count];
            chatServer.users.Values.CopyTo(clients, 0);

            for (int i = 0; i < clients.Length; i++) {
                try {
                    if (message.Trim().Equals("") || clients[i] == null) {
                        continue;
                    }
                    sw = new StreamWriter(clients[i].GetStream());
                    sw.WriteLine("0" + from + " " + message);
                    sw.Flush();
                    sw = null;
                } catch {
                    removeUser(clients[i]);
                }
            }
        }
예제 #3
0
 public static void statusChangeUserList(StatusChangedEventArgs e)
 {
     userListStatusChangedHandler userListHandler = userListStatusChanged;
     if (userListHandler != null) userListHandler (null, e);
 }
예제 #4
0
 public static string updateUsers()
 {
     userList = "";
     foreach (DictionaryEntry connectedUser in chatServer.users) {
         userList += connectedUser.Key.ToString() + " ";
     }
     messageArgs = new StatusChangedEventArgs(userList);
     statusChangeUserList(messageArgs);
     return userList.Trim();
 }
예제 #5
0
 public void messageStatusChanged(object sender, StatusChangedEventArgs e)
 {
     Invoke(new parseCallback(parseQuacket), new Object[] {e.data});
 }