Exemplo n.º 1
0
 private void Btn_Celestron_Click(object sender, EventArgs e)
 {
     try
     {
         if (Btn_Celestron.BackColor != Color.Green)
         {
             Sp_Puertos.DiscardOutBuffer();
             BufferOut = "U";
             Sp_Puertos.Write(BufferOut);
             Btn_Celestron.BackColor = Color.Green;
             MessageBox.Show("Pulse 'Alinear' para escoger alineación manual o alineación del sistema solar.", "Celestron Presionado");
             Fnc_Desactivar_Botones2();
         }
         else
         {
             Sp_Puertos.DiscardOutBuffer();
             BufferOut = "X";
             Sp_Puertos.Write(BufferOut);
             Btn_Celestron.BackColor = Btn_Alinear.BackColor;
             Fnc_Activar_Botones2();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + " Pulse 'Desconectar' y vuelva a probar.");
     }
 }
Exemplo n.º 2
0
 private void Btn_VelocidadMotor_Click(object sender, EventArgs e)
 {
     try
     {
         Sp_Puertos.DiscardOutBuffer();
         BufferOut = "W";
         Sp_Puertos.Write(BufferOut);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + " Pulse 'Desconectar' y vuelva a probar.");
     }
 }
Exemplo n.º 3
0
 private void Btn_Abajo_MouseDown(object sender, MouseEventArgs e)
 {
     try
     {
         Sp_Puertos.DiscardOutBuffer();
         BufferOut = "J";
         Sp_Puertos.Write(BufferOut);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + " Pulse 'Desconectar' y vuelva a probar.");
     }
 }
Exemplo n.º 4
0
        /*private void Tmr_Timer_Tick(object sender, EventArgs e)
         * {
         *  try
         *  {
         *      BufferIn = Sp_Puertos.ReadExisting();
         *      if (BufferIn != "")
         *      {
         *          //Txt_BufferIn.Text = BufferIn;
         *          BufferIn = "";
         *          Sp_Puertos.DiscardInBuffer();
         *      }
         *  }
         *  catch { }
         * }*/

        private void Btn_Alinear_Click(object sender, EventArgs e)
        {
            try
            {
                Sp_Puertos.DiscardOutBuffer();
                BufferOut = "A";
                Sp_Puertos.Write(BufferOut);
                if (Btn_Celestron.BackColor == Color.Green)
                {
                    Sp_Puertos.DiscardOutBuffer();
                    BufferOut = "X";
                    Sp_Puertos.Write(BufferOut);
                    Btn_Celestron.BackColor = Btn_Alinear.BackColor;
                    Fnc_Activar_Botones2();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + " Pulse 'Desconectar' y vuelva a probar.");
            }
        }
Exemplo n.º 5
0
 private void Btn_Conectar_Click(object sender, EventArgs e)
 {
     if (Btn_Conectar.Text == "Conectar")
     {
         try
         {
             Sp_Puertos.PortName = Cbo_Puertos.Text;
             Sp_Puertos.Open();
             //Tmr_Timer.Enabled = true;
             Btn_Conectar.Text = "Desconectar";
             Btn_DeterminarConexion.Enabled = false;
             Fnc_Activar_Botones();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     else if (Btn_Conectar.Text == "Desconectar")
     {
         try
         {
             Btn_Conectar.Text = "Conectar";
             //Tmr_Timer.Enabled = false;
             Sp_Puertos.Close();
             Btn_DeterminarConexion.Enabled = true;
             Fnc_Desactivar_Botones();
             Btn_DeterminarConexion_Click(sender, e);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
             Btn_DeterminarConexion_Click(sender, e);
             Btn_DeterminarConexion.Enabled = true;
             Fnc_Desactivar_Botones();
         }
     }
 }
Exemplo n.º 6
0
 private void Btn_Abajo_MouseUp(object sender, MouseEventArgs e)
 {
     Sp_Puertos.DiscardOutBuffer();
     BufferOut = "K";
     Sp_Puertos.Write(BufferOut);
 }