Ejemplo n.º 1
0
 private void btnStopServer_Click(object sender, EventArgs e)
 {
     if (MainServer.Active)
     {
         lbConnectedClients.Items.Clear();
         MainServer.Stop();
         GetDataLoop.Stop();
         lblStatus.ForeColor = Color.Red;
         lblStatus.Text      = "Offline";
         MessageBox.Show("Server stopped.", "Server Stopped", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Ejemplo n.º 2
0
 private void btnStartServer_Click(object sender, EventArgs e)
 {
     if (!MainServer.Active)
     {
         try
         {
             int Port = Settings.GetPort();
             MainServer.Start(Port);
             lblStatus.ForeColor = Color.Green;
             lblStatus.Text      = "Online";
             GetDataLoop.Start();
             MessageBox.Show("Server started on port " + Port + ".", "Server Started", MessageBoxButtons.OK,
                             MessageBoxIcon.Information);
         }
         catch (Exception EX)
         {
             MessageBox.Show("Error: " + EX.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }