Exemple #1
0
 /// <summary>
 /// Método que carga los puertos serie activos en el equipo en el ComboBox
 /// </summary>
 public void LoadPorts()
 {
     _sp_services = new SP_services();
     string[] ports = _sp_services.Ports;
     cboPort.Items.Clear();
     cboPort.Items.AddRange(ports);
     if (cboPort.Items.Count > 0)
     {
         cboPort.SelectedIndex = 0;
         if (_proyect.Name != null)
         {
             this.ViewConnectionClose();
         }
     }
     else
     {
         if (_proyect.Name != null)
         {
             this.ViewConnectionClose();
         }
         else
         {
             this.ViewNoProyect();
         }
     }
 }
Exemple #2
0
 /// <summary>
 /// Método encargado de abrir una conexión con el puerto serie elegido en el comboBox
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnStart_Click(object sender, EventArgs e)
 {
     try
     {
         _sp_services = new SP_services(_proyect, _cul);
         _sp_services.SerialPort.PortName = cboPort.Text;
         _threadSaveRow = new Thread(() => _sp_services.OpenConnection());
         _threadSaveRow.Start();
         this.ViewConnectionOpen();
         this._timerRefreshDataGrid.Enabled = true;
     }
     catch (Exception ex)
     {
         this.ViewConnectionClose();
         _exMg.HandleException(ex);
     }
 }
Exemple #3
0
 /// <summary>
 /// Evento que se invoca al cargar el formulario. Carga los elementos necesarios para conformar la ventana.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Form1_Load(object sender, EventArgs e)
 {
     _sp_services = new SP_services();
     this.LoadPorts();
     this.ViewNoProyect();
 }