コード例 #1
0
 private void cmdScollega_Click(object sender, EventArgs e)
 {
     try {
         if (_controller != null)
         {
             _controller.RemoveListener(_listener);
             _controller.Dispose();
         }
         Log("Disconesso");
         serial.Close();
     }
     catch (Exception ex) {
         LogError("Errore Disconnessione", ex);
     } finally {
         lblStato.Text      = "Not Connected";
         lblStato.ForeColor = Color.Red;
         _controller        = null;
         _listener          = null;
         lblFrame.Text      = "";
     }
 }
コード例 #2
0
        private void cmdCollega_Click(object sender, EventArgs e)
        {
            try {
                Log("");
                Log("---------------------------------------------------------");
                Log("Inizializzazione");
                _controller = new Controller();
                _listener   = new LeapEventListener(this);
                _controller.AddListener(_listener);
                lblStato.Text      = "Connected";
                lblStato.ForeColor = Color.Green;
                Log("Connesso Leap");

                serial.PortName = cmbSerial.Text;
                serial.Open();
                Sendhoriz(0, 0);
            }
            catch (Exception ex) {
                LogError("Errore connessione", ex);
                // cmdScollega_Click(null, null);
            }
        }