} // 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
} // btnRetryRemote_Click private void btnAdd_Click(object sender, EventArgs e) { cmbChannelName.Text = cmbChannelName.Text.Trim(); cmbChannelName.Text = cmbChannelName.Text.Replace("|", ""); if (Channels.IsAccount(cmbChannelName.Text)) { MessageBox.Show( cmbChannelName.Text + " is in use as an account name...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbChannelName.Focus(); return; } if (Channels.IsChannel(cmbChannelName.Text)) { MessageBox.Show( "The channel name " + cmbChannelName.Text + " is already in use...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbChannelName.Focus(); } else { var stcNewChannel = default(TChannelProperties); { var withBlock = stcNewChannel; 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.Enabled = chkEnabled.Checked; withBlock.EnableAutoforward = true; // Packet Channels always enabled } Channels.AddChannel(ref stcNewChannel); Channels.FillChannelCollection(); FillChannelList(); btnAdd.Enabled = false; btnRemove.Enabled = true; btnUpdate.Enabled = true; // Me.Close() } } // btnAdd_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
} // SetEntries private void btnAdd_Click(object sender, EventArgs e) { cmbChannelName.Text = cmbChannelName.Text.Trim(); cmbChannelName.Text = cmbChannelName.Text.Replace("|", ""); if (!Globals.IsValidFileName(cmbChannelName.Text)) { cmbChannelName.Focus(); return; } if (string.IsNullOrEmpty(cmbChannelName.Text)) { MessageBox.Show("A channel name is required...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbChannelName.Focus(); return; } if (Channels.IsAccount(cmbChannelName.Text)) { MessageBox.Show(cmbChannelName.Text + " is in use as an account name...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbChannelName.Focus(); return; } if (Channels.IsChannel(cmbChannelName.Text)) { MessageBox.Show("The channel name " + cmbChannelName.Text + " is already in use...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbChannelName.Focus(); } else { var stcNewChannel = new TChannelProperties() { ChannelType = ChannelMode.Telnet, ChannelName = cmbChannelName.Text, Priority = Convert.ToInt32(nudPriority.Value), Enabled = chkEnabled.Checked, EnableAutoforward = true, // Telnet Channels always enabled RemoteCallsign = "WL2K" }; Channels.AddChannel(ref stcNewChannel); Channels.FillChannelCollection(); FillChannelList(); ClearEntries(); Globals.Settings.Save("Properties", "Last Telnet Channel", cmbChannelName.Text); Close(); } } // btnAdd_Click
} // btnAdd_Click private void btnRemove_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 if (MessageBox.Show( "Confirm removal of telnet channel " + cmbChannelName.Text + "...", "Remove Channel", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Channels.RemoveChannel(cmbChannelName.Text); Channels.FillChannelCollection(); FillChannelList(); Globals.Settings.Save("Properties", "Last Telnet Channel", ""); Close(); } } // btnRemove_Click
} // btnAdd_Click private void btnRemove_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 (MessageBox.Show( "Confirm removal of packet channel " + cmbChannelName.Text + "...", "Remove Channel", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Channels.RemoveChannel(cmbChannelName.Text); Channels.FillChannelCollection(); FillChannelList(); // Me.Close() } ClearEntries(); } // btnRemove_Click
public PrimaryThread() { // // Initializes the program on startup... // int intIndex = Globals.Settings.Get("Properties", "Default Local IP Address Index", 0); if (intIndex < 0) { intIndex = 0; } if (Globals.strLocalIPAddresses.Length - 1 >= intIndex) { Globals.strLocalIPAddress = Globals.strLocalIPAddresses[intIndex]; } Globals.SiteCallsign = Globals.Settings.Get("Properties", "Site Callsign", ""); Globals.SiteGridSquare = Globals.Settings.Get("Properties", "Grid Square", ""); Globals.intSMTPPortNumber = Globals.Settings.Get("Properties", "SMTP Port Number", 25); Globals.intPOP3PortNumber = Globals.Settings.Get("Properties", "POP3 Port Number", 110); Globals.blnLAN = Globals.Settings.Get("Properties", "LAN Connection", true); Globals.blnEnableRadar = Globals.Settings.Get("Properties", "Enable Radar", false); Globals.strServiceCodes = Globals.Settings.Get("Properties", "ServiceCodes", ""); if (string.IsNullOrEmpty(Globals.strServiceCodes)) { if (Globals.IsMARSCallsign(Globals.SiteCallsign)) { Globals.strServiceCodes = Globals.strMARSServiceCode; } else { Globals.strServiceCodes = Globals.strHamServiceCode; } Globals.Settings.Save("Properties", "ServiceCodes", Globals.strServiceCodes); } string strSitePassword = Globals.Settings.Get("Properties", "Site Password", ""); Globals.POP3Password = Globals.Settings.Get("Properties", "EMail Password", strSitePassword); Globals.Settings.Save("Properties", "EMail Password", Globals.POP3Password); Globals.Settings.Save("Properties", "Site Password", ""); Globals.SecureLoginPassword = Globals.Settings.Get("Properties", "Secure Login Password", ""); Channels.FillChannelCollection(); try { Globals.PollingData.LoadParameters(); } catch (Exception ex) { _log.Error("[Main.Startup C] " + ex.Message); } try { // Open the properties dialog box if no initial configuration has been set... DialogSitePropertiesViewModel vm = new DialogSitePropertiesViewModel(); if (vm.IsCallsignAndGridSquareValid() == false) { UserInterfaceFactory.GetUiSystem().DisplayForm(AvailableForms.SiteProperties, vm); if (vm.IsCallsignAndGridSquareValid() == false) { MessageBox.Show("Paclink must have a valid initial configuration to continue...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); MyApplication.Forms.Main.CloseWindow(); return; } } } catch (Exception ex) { _log.Error("[Main.Startup F] " + ex.Message); } try { Accounts.RefreshAccountsList(); } catch (Exception ex) { _log.Error("[Main.Startup G] " + ex.Message); } try { MyApplication.Forms.Main.UpdateChannelList(); } catch (Exception ex) { _log.Error("[Main.Startup G] " + ex.Message); } MyApplication.Forms.Main.UpdateSiteCallsign(Globals.SiteCallsign); if (Globals.UseRMSRelay()) { Globals.queChannelDisplay.Enqueue("G*** Paclink is set to connect to RMS Relay."); } if (Globals.blnForceHFRouting) { Globals.queChannelDisplay.Enqueue("G*** Paclink is set to send messages via radio-only forwarding."); } Globals.queChannelDisplay.Enqueue("G*** Paclink " + Application.ProductVersion + " ready..."); MyApplication.Forms.Main.EnableMainWindowInterface(); if (thrSMTP != null) { _abortSMTPThread = true; thrSMTP.Join(); thrSMTP = null; } thrSMTP = new Thread(SMTPThread); thrSMTP.Name = "SMTP"; thrSMTP.Start(); if (thrChannel != null) { _abortChannelThread = true; thrChannel.Join(); thrChannel = null; } thrChannel = new Thread(ChannelThread); thrChannel.Name = "Channel"; thrChannel.Start(); }
} // cmbTNCtype_TextChanged private void btnAdd_Click(object sender, EventArgs e) { if (!Globals.IsValidFileName(cmbChannelName.Text)) { cmbChannelName.Focus(); return; } cmbChannelName.Text = cmbChannelName.Text.Trim(); cmbChannelName.Text = cmbChannelName.Text.Replace("|", ""); if (chkAutoforwardEnabled.Checked) { ConfirmAutoforward(); } if (Channels.IsAccount(cmbChannelName.Text)) { MessageBox.Show(cmbChannelName.Text + " is in use as an account name...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbChannelName.Focus(); return; } 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", "Radio Address 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 (Channels.IsChannel(cmbChannelName.Text)) { MessageBox.Show("The channel name " + cmbChannelName.Text + " is already in use...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbChannelName.Focus(); } else { var stcNewChannel = default(TChannelProperties); UpdateChannelProperties(ref stcNewChannel); Channels.AddChannel(ref stcNewChannel); Channels.FillChannelCollection(); FillChannelList(); Globals.Settings.Save("Properties", "Last Pactor Channel", cmbChannelName.Text); btnAdd.Enabled = false; btnRemove.Enabled = true; btnUpdate.Enabled = true; // Me.Close() } } // btnAdd_Click
} // btnBrowseConfiguration_Click private void btnAdd_Click(object sender, EventArgs e) { if (!Globals.IsValidFileName(cmbChannelName.Text)) { cmbChannelName.Focus(); return; } cmbChannelName.Text = cmbChannelName.Text.Trim(); cmbChannelName.Text = cmbChannelName.Text.Replace("|", ""); if (string.IsNullOrEmpty(cmbTNCBaudRate.Text.Trim())) { MessageBox.Show("Select TNC Baud rate!", "No baud rate selected!", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (string.IsNullOrEmpty(cmbOnAirBaud.Text.Trim())) { MessageBox.Show("Select On Air Baud rate!", "No baud rate selected!", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (Channels.IsAccount(cmbChannelName.Text)) { MessageBox.Show(cmbChannelName.Text + " is in use as an account name...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbChannelName.Focus(); return; } if (rdoManual.Checked == false) { if (string.IsNullOrEmpty(cmbRadioModel.Text.Trim()) | string.IsNullOrEmpty(cmbRadioBaud.Text.Trim()) | string.IsNullOrEmpty(cmbRadioPort.Text.Trim())) { MessageBox.Show("The parameters for Radio control are not complete!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } if (Channels.IsChannel(cmbChannelName.Text)) { MessageBox.Show("The channel name " + cmbChannelName.Text + " is already in use...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); cmbChannelName.Focus(); } 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 (rdoSerial.Checked & (cmbRadioPort.Text ?? "") == (cmbTNCSerialPort.Text ?? "")) { if (!(cmbRadioModel.Text == "Kenwood TS-2000" & cmbTNCType.Text == "TS-2000 int" | cmbRadioModel.Text == "Kenwood TM-D700" & cmbTNCType.Text == "TM-D700 int" | cmbRadioModel.Text == "Kenwood TH-D7" & cmbTNCType.Text == "TH-D7 int")) { MessageBox.Show("Radio Control and TNC must use different serial ports.", "Serial Port Conflict", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } var stcNewChannel = default(TChannelProperties); UpdateChannelProperties(ref stcNewChannel); Channels.AddChannel(ref stcNewChannel); Channels.FillChannelCollection(); FillChannelList(); Globals.Settings.Save("Properties", "Last Packet TNC Channel", cmbChannelName.Text); } btnAdd.Enabled = false; btnRemove.Enabled = true; btnUpdate.Enabled = true; // Me.Close() } // btnAdd_Click