Пример #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);
            }
        }
Пример #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);
            }
        }