Ejemplo n.º 1
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            if (__Port != null)
            {
                __Port.Dispose();
            }



            try
            {
                __Port = new ComProgrammer((string)cbComPort.SelectedItem);
                __Port.OnStateChanged += PortOnOnStateChanged;

                __Port.Connect();
            }
            catch (Exception exx)
            {
                SetErrrorState("Connection error");
                MessageBox.Show(this, exx.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void btnConnect_Click(object sender, EventArgs e)
        {
            if (__Port != null)
            {
                __Port.Dispose();
            }



            try
            {
                __Port = new ComProgrammer((string)cbComPort.SelectedItem);
                __Port.OnStateChanged += PortOnOnStateChanged;

                __Port.Connect();
            }
            catch (Exception exx)
            {
                SetErrrorState("Connection error");
                ShowError(exx.Message);
            }
        }