private void button1_Click(object sender, EventArgs e) { _server = new Server(); _server.OnWriteLog += new WriteLogHandle(server_OnWriteLog); _server.OnUserChanged += new UserChangedHandle(OnUserChanged); try { _server.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
static void Main(string[] args) { Server _server; _server = new Server(); _server.OnWriteLog += new WriteLogHandle(server_OnWriteLog); _server.OnUserChanged += new UserChangedHandle(OnUserChanged); try { _server.Start(); } catch (Exception ex) { System.Console.WriteLine("[ERROR]{0}", ex.Message); } }