} // btnRemove_Click private void btnUpdate_Click(object sender, EventArgs e) { if (chkAutoforwardEnabled.Checked) { ConfirmAutoforward(); } int audioFreq = 0; if (!int.TryParse(txtAudioCenter.Text.Trim(), out audioFreq)) { MessageBox.Show("Audio Tones Center must be between 1000 and 2300 Hz", "Tone Center Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (audioFreq < 1000 || audioFreq > 2300) { MessageBox.Show("Audio Tones Center must be between 1000 and 2300 Hz", "Tone Center Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (txtRadioAddress.Enabled) { try { byte byt = byte.Parse(txtRadioAddress.Text.ToUpper().Trim(), System.Globalization.NumberStyles.HexNumber); } catch { MessageBox.Show("Radio Address must be between 00 and FF hex", "Tone Center Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } if (rdoSerial.Checked & (cmbRadioPort.Text ?? "") == (cmbTNCSerialPort.Text ?? "")) { MessageBox.Show("Radio Control and TNC must use different serial ports.", "Serial Port Conflict", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (cmbChannelName.Items.Contains(cmbChannelName.Text) == false) { MessageBox.Show("The pactor channel " + cmbChannelName.Text + " is not found...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { var stcUpdateChannel = default(TChannelProperties); UpdateChannelProperties(ref stcUpdateChannel); Channels.UpdateChannel(ref stcUpdateChannel); Channels.FillChannelCollection(); FillChannelList(); // Clear channel name from the fast start list... if (Globals.cllFastStart.Contains(cmbChannelName.Text)) { Globals.cllFastStart.Remove(cmbChannelName.Text); } Globals.Settings.Save("Properties", "Last Pactor Channel", cmbChannelName.Text); // Me.Close() } } // btnUpdate_Click
} // btnRemove_Click private void btnUpdate_Click(object sender, EventArgs e) { if (cmbChannelName.Items.Contains(cmbChannelName.Text) == false) { MessageBox.Show("The telnet channel " + cmbChannelName.Text + " is not found...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { var stcUpdateChannel = default(TChannelProperties); { var withBlock = stcUpdateChannel; withBlock.ChannelType = ChannelMode.Telnet; withBlock.ChannelName = cmbChannelName.Text; withBlock.Priority = Convert.ToInt32(nudPriority.Value); withBlock.Enabled = chkEnabled.Checked; withBlock.EnableAutoforward = true; // Telnet Channels always enabled withBlock.RemoteCallsign = "WL2K"; } Channels.UpdateChannel(ref stcUpdateChannel); Channels.FillChannelCollection(); Globals.Settings.Save("Properties", "Last Telnet Channel", cmbChannelName.Text); Close(); } } // btnUpdate_Click
} // btnRemove_Click private void btnUpdate_Click(object sender, EventArgs e) { if (cmbChannelName.Items.Contains(cmbChannelName.Text) == false) { MessageBox.Show( "The AGW packet channel " + cmbChannelName.Text + " is not found...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else if (string.IsNullOrEmpty(cmbAGWPort.Text.Trim())) { MessageBox.Show( "AGW Port not selected!...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return; // } else if (string.IsNullOrEmpty(txtRemoteCallsign.Text.Trim())) { MessageBox.Show( "No remote callsign entered!...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { var stcUpdateChannel = default(TChannelProperties); { var withBlock = stcUpdateChannel; withBlock.ChannelType = ChannelMode.PacketAGW; withBlock.ChannelName = cmbChannelName.Text; withBlock.Priority = Convert.ToInt32(nudPriority.Value); withBlock.RemoteCallsign = txtRemoteCallsign.Text; withBlock.AGWTimeout = Convert.ToInt32(nudActivityTimeout.Value); withBlock.AGWPacketLength = Convert.ToInt32(nudPacketLength.Value); withBlock.AGWPort = cmbAGWPort.Text; withBlock.AGWScript = txtScript.Text; withBlock.AGWScriptTimeout = Convert.ToInt32(nudScriptTimeout.Value); withBlock.AGWMaxFrames = Convert.ToInt32(nudMaxOutstanding.Value); withBlock.Enabled = chkEnabled.Checked; withBlock.EnableAutoforward = true; // Packet Channels always enabled } Channels.UpdateChannel(ref stcUpdateChannel); Channels.FillChannelCollection(); FillChannelList(); // Me.Close() } } // btnUpdate_Click
} // btnRemove_Click private void btnUpdate_Click(object sender, EventArgs e) { if (cmbChannelName.Items.Contains(cmbChannelName.Text) == false) { MessageBox.Show("The packet channel " + cmbChannelName.Text + " is not found...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (!System.IO.File.Exists(txtTNCConfigurationFile.Text)) { MessageBox.Show("Invalid TNC configuration file.", "File Not Found", MessageBoxButtons.OK, MessageBoxIcon.Information); txtTNCConfigurationFile.Focus(); return; } if (!rdoManual.Checked) { if (!Globals.WithinLimits(txtFreqMHz.Text, 2400, 29)) { MessageBox.Show("Frequency must be in MHz between 29.0 and 2400", "Frequency Error", MessageBoxButtons.OK, MessageBoxIcon.Information); txtFreqMHz.Focus(); return; } if (cmbTNCType.Text == "TS-2000 int") { MessageBox.Show("Radio Control of TS-2000 not possible when using internal TNC!", "Control Limitation", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (rdoSerial.Checked & (cmbRadioPort.Text ?? "") == (cmbTNCSerialPort.Text ?? "")) { MessageBox.Show("Radio Control and TNC must use different serial ports.", "Serial Port Conflict", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } var stcUpdateChannel = default(TChannelProperties); UpdateChannelProperties(ref stcUpdateChannel); Channels.UpdateChannel(ref stcUpdateChannel); Channels.FillChannelCollection(); FillChannelList(); // Clear channel name from the fast start list... if (Globals.cllFastStart.Contains(cmbChannelName.Text)) Globals.cllFastStart.Remove(cmbChannelName.Text); Globals.Settings.Save("Properties", "Last Packet TNC Channel", cmbChannelName.Text); // Me.Close() } } // btnUpdate_Click