示例#1
0
        private void btnStartServer_Click(object sender, EventArgs e)
        {
            if (btnStartServer.Text == "啟動")
            {
                try
                {
                    server.ServerStartup(Convert.ToInt32(textBox1.Text), 10);
                    btnStartServer.Text = "關閉";
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
//                try
                {
                    server.CloseServer();
                    btnStartServer.Text = "啟動";
                }

//                catch (Exception ex)
                {
//                    MessageBox.Show(ex.Message);
                }
            }
        }