private void ServerErrorEventHandler(object handler, ServerErrorEventInfo e) { if (e.info != "Connection to server has been served") { return; } //я не понимаю что это но оно работает Action action = () => { sendMessage_textBox.Clear(); Chat_textBox.Clear(); // users.Items.Clear(); // client = new Client(); this.Hide(); }; if (InvokeRequired) { Invoke(action); } else { action(); } }
private void HandlerServerErrorEvent(object sender, ServerErrorEventInfo e) { if (e.info == "Connection to server has been served") { Action action = () => this.Show(); if (InvokeRequired) { Invoke(action); } else { action(); } } MessageBox.Show(e.info, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
public static void ServerErrorEventRun(ServerErrorEventInfo e) { EventHandler <ServerErrorEventInfo> handler = ServerErrorEvent; handler(null, e); }