public static void statusChangeMessage(StatusChangedEventArgs e) { messageStatusChangedHandler messageHandler = messageStatusChanged; if (messageHandler != null) messageHandler (null, e); }
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]); } } }
public static void statusChangeUserList(StatusChangedEventArgs e) { userListStatusChangedHandler userListHandler = userListStatusChanged; if (userListHandler != null) userListHandler (null, e); }
public static string updateUsers() { userList = ""; foreach (DictionaryEntry connectedUser in chatServer.users) { userList += connectedUser.Key.ToString() + " "; } messageArgs = new StatusChangedEventArgs(userList); statusChangeUserList(messageArgs); return userList.Trim(); }
public void messageStatusChanged(object sender, StatusChangedEventArgs e) { Invoke(new parseCallback(parseQuacket), new Object[] {e.data}); }