private void button1_Click(object sender, EventArgs e) { if (!server) { server = true; Myserver.Start(8080); button1.Text = "Stop Server"; } else { server = false; Myserver.Stop(); tvClientList.Nodes[0].Nodes.Clear(); button1.Text = "Start Server"; } }
/// <summary> /// Event Called when Main Form is closed. It stops the server and Disposes all Resources /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_FormClosing(Object sender, FormClosingEventArgs e) { Myserver.Stop(); }