private void barButtonItem2_ItemClick(object sender, ItemClickEventArgs e) { if (m_server.IsServerStarted) { m_server.StopServer(); } }
private void button1_Click(object sender, EventArgs e) { if (m_server.IsServerStarted) { m_server.StopServer(); } }
public bool Start_ConsoleServer() { if (!IsServerStarted) { string port; port = string.Format("{0:D3}", Settings.Default.PortServer); ServerOps ops = new ServerOps(this, port, this); m_server.StartServer(ops); IsServerStarted = true; } else { if (m_server.IsServerStarted) { m_server.StopServer(); IsServerStarted = false; Program.AddLog("Server Stopped"); } } return(IsServerStarted); }
private void btnConnect_Click(object sender, EventArgs e) { if (btnConnect.Text.Equals("Start")) { tbPort.Enabled = false; btnConnect.Text = "Stop"; string port = tbPort.Text; ServerOps ops = new ServerOps(this, port, this); //AddMsg("NoDelay: " + ops.NoDelay.ToString() + " MaxSocketCount: " + ops.MaxSocketCount.ToString()); m_server.StartServer(ops); timer1.Enabled = true; } else { tbPort.Enabled = true; btnConnect.Text = "Start"; if (m_server.IsServerStarted) { m_server.StopServer(); timer1.Enabled = false; } } }
private void btnConnect_Click(object sender, EventArgs e) { if (btnConnect.Text.Equals("Start")) { string port = tbPort.Text; tbPort.Enabled = false; btnConnect.Text = "Stop"; tbSend.Enabled = true; btnSend.Enabled = true; ServerOps ops = new ServerOps(this, port, this); m_server.StartServer(ops); } else { tbPort.Enabled = true; btnConnect.Text = "Start"; tbSend.Enabled = false; btnSend.Enabled = false; if (m_server.IsServerStarted) { m_server.StopServer(); } } }