예제 #1
0
파일: Form.cs 프로젝트: k1xm/SO2R-Interface
        /// <summary>
        /// Stop handling OTRSP and Winkey commands
        /// </summary>
        private void Stop()
        {
            bStartStop.Text = "Start";

            if (_device != null)
            {
                _device.Close();
                _device = null;
            }

            if (_otrsp != null)
            {
                _otrsp.Close();
                _otrsp = null;
            }

            if (_keyer != null)
            {
                _keyer.Close();
                _keyer = null;
            }

            cSo2rDevice.Enabled = true;
            cKeyer.Enabled      = true;
            cManual.Enabled     = true;

            if (!_data.Manual)
            {
                cOtrsp.Enabled    = true;
                _data.Tx_Changed -= UpdateTx;
                _data.Rx_Changed -= UpdateRx;
            }

            rTX1.Enabled    = false;
            rTX2.Enabled    = false;
            rRX1.Enabled    = false;
            rRX2.Enabled    = false;
            rStereo.Enabled = false;
            gTX.Enabled     = false;
            gRX.Enabled     = false;

            Text = "SO2R Interface";
        }
예제 #2
0
파일: Form.cs 프로젝트: k1xm/SO2R-Interface
        /// <summary>
        /// Start handling OTRSP and Winkey commands
        /// </summary>
        private void Start()
        {
            bStartStop.Text = "Stop";

            try
            {
                _device = new Device(_data);
                _device.Open();
            }
            catch (Exception e)
            {
                ErrorStop("Device", _data.DevicePort, e);
                return;
            }

            if (!_data.Manual)
            {
                try
                {
                    _otrsp = new Otrsp(_data);
                    _otrsp.Open();
                }
                catch (Exception e)
                {
                    ErrorStop("OTRSP", _data.OtrspPort, e);
                    return;
                }
            }

            try
            {
                _keyer = new Keyer(_data);
                _keyer.Open();
            }
            catch (Exception e)
            {
                ErrorStop("Keyer", _data.KeyerPort, e);
                return;
            }

            cSo2rDevice.Enabled = false;
            cKeyer.Enabled      = false;
            cManual.Enabled     = false;

            if (_data.Manual)
            {
                rTX1.Enabled    = true;
                rTX2.Enabled    = true;
                rRX1.Enabled    = true;
                rRX2.Enabled    = true;
                rStereo.Enabled = true;
                gTX.Enabled     = true;
                gRX.Enabled     = true;
            }
            else
            {
                cOtrsp.Enabled    = false;
                _data.Tx_Changed += UpdateTx;
                _data.Rx_Changed += UpdateRx;
            }
        }