示例#1
0
        private void btnChangeMode_Click(object sender, EventArgs e)
        {
            //AppData.GetInputString("Ingrese el password", "",true);

            if (btnChangeMode.Text.Contains("Iniciar"))
            {
                lblServerSwitch.Text      = "Server ON";
                lblServerSwitch.ForeColor = Color.YellowGreen;
                udpMain.Port = int.Parse(txtSocket.Text);
                udpMain.BeginListening();
                txtSocket.ReadOnly = true;
                picComm.Image      = global::UDPDataServer.Properties.Resources.gif_comunication_on;
                btnChangeMode.Text = "Detener";
                Console.WriteLine("Servidor Iniciado");
            }
            else
            {
                if (MessageBox.Show("Desea continuar deteniendo el servicio?",
                                    "Confirmación",
                                    MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }

                lblServerSwitch.Text      = "Server OFF";
                lblServerSwitch.ForeColor = Color.Red;
                udpMain.StopListening(false);
                txtSocket.ReadOnly = false;
                picComm.Image      = global::UDPDataServer.Properties.Resources.gif_comunication_off;
                btnChangeMode.Text = "Iniciar";
            }
        }
示例#2
0
 private void Button1_Click(object sender, EventArgs e)
 {
     udpMain.Port = int.Parse(txtPort.Text);
     udpMain.BeginListening();
     btnStopListening.Enabled  = true;
     btnBeginListening.Enabled = false;
     txtSocket.ReadOnly        = true;
 }