private void transceiverPinChanged(object sender, EventArgs e) { TransceiverPinSettings tpsSender = (TransceiverPinSettings)sender; string freePin = null; foreach (string pin in SerialDevice.SerialDevice.PINS) { bool busy = false; foreach (TransceiverPinSettings tpsControl in transceiverPinSettings) { if (tpsControl.pin == pin) { busy = true; break; } } if (!busy) { freePin = pin; break; } } if (freePin != null) { foreach (TransceiverPinSettings tpsControl in transceiverPinSettings) { if (tpsControl != tpsSender && tpsControl.pin == tpsSender.pin) { tpsControl.pin = freePin; break; } } } updateTransceiverController(); }
public FormSettings(string _dataPath) { dataPath = _dataPath; InitializeComponent(); mainFormPanelCheckboxes = new Dictionary <string, CheckBox>() { { "qth1_2", checkBoxViewQth1_2 }, { "qth3Loc", checkBoxViewQth3Loc }, { "qsoComments", checkBoxViewQsoComments }, { "statFilter", checkBoxViewStatFilter }, { "cwMacros", checkBoxViewCwMacro }, { "callsignId", checkBoxViewCallsignId } }; updateIntervalRadioButtons = new Dictionary <int, RadioButton>() { { 10 * 1000, radioButtonUpdInterval10s }, { 60 * 1000, radioButtonUpdInterval1m } }; foreach (SerialDeviceInfo sp in serialDevices) { comboBoxPort.Items.Add(sp.caption); int w = TextRenderer.MeasureText(sp.caption, comboBoxPort.Font).Width; if (comboBoxPort.DropDownWidth < w) { comboBoxPort.DropDownWidth = w; } } int pinCount = 0; foreach (string pinFunction in TransceiverController.PIN_FUNCTIONS) { TransceiverPinSettings tpsControl = new TransceiverPinSettings(pinFunction); transceiverPinSettings.Add(tpsControl); panelTransceiverSerial.Controls.Add(tpsControl); tpsControl.Location = new Point(1, 25 + (pinCount++) * (tpsControl.Height + 2)); tpsControl.pinChanged += transceiverPinChanged; tpsControl.invertChanged += transceiverPinInvertChanged; tpsControl.testMouseDown += testPinMouseDown; tpsControl.testMouseUp += testPinMouseUp; } for (int field = 0; field < TnxlogConfig.QthFieldCount; field++) { LabelTextBox ltb = new LabelTextBox(); qthFieldAdifContols.Add(ltb); groupBoxAdifFields.Controls.Add(ltb); ltb.Location = new Point(1, 14 + field * (ltb.Height + 2)); } ltbComment = new LabelTextBox(); qthFieldAdifContols.Add(ltbComment); groupBoxAdifFields.Controls.Add(ltbComment); ltbComment.Location = new Point(1, 14 + TnxlogConfig.QthFieldCount * (ltbComment.Height + 2)); ltbComment.labelText = "Comment"; }
private void testPinMouseDown(object sender, EventArgs e) { TransceiverPinSettings tpsSender = (TransceiverPinSettings)sender; transceiverController.setPin(tpsSender.function, false); }