private void btnSerialOK_Click(object sender, EventArgs e) { if (!int.TryParse(tbId.Text, out int channelId)) { mf.TimedMessageBox(2000, "Invalid Id", $"Id '{tbId.Text}' is not a valid number"); DialogResult = DialogResult.None; return; } if (string.IsNullOrEmpty(tbName.Text)) { mf.TimedMessageBox(2000, "Invalid Name", $"Name is not filled in"); DialogResult = DialogResult.None; return; } if (string.IsNullOrEmpty(tbFrequency.Text)) { mf.TimedMessageBox(2000, "Invalid Frequency", $"Frequency is not filled in"); DialogResult = DialogResult.None; return; } Channel.Id = channelId; Channel.Name = tbName.Text; Channel.Frequency = tbFrequency.Text; if (!string.IsNullOrEmpty(tbLat.Text) && !string.IsNullOrEmpty(tbLon.Text)) { Channel.Location = $"{tbLat.Text} {tbLon.Text}"; } }
private void btnRadioOK_Click(object sender, EventArgs e) { if (cboxIsRadioOn.Checked && lvChannels.SelectedItems.Count == 0) { mf.TimedMessageBox(2000, "No channel", "Radio is set to on. But no channel is selected"); // Cancel close DialogResult = DialogResult.None; return; } if (lvChannels.SelectedItems.Count > 0) { var selectedChannel = (CRadioChannel)lvChannels.SelectedItems[0].Tag; Properties.Settings.Default.setPort_radioChannel = selectedChannel.Frequency; } Properties.Settings.Default.setPort_portNameRadio = cboxRadioPort.Text; Properties.Settings.Default.setPort_baudRateRadio = cboxBaud.Text; Properties.Settings.Default.setRadio_isOn = cboxIsRadioOn.Checked; if (Properties.Settings.Default.setRadio_isOn && Properties.Settings.Default.setNTRIP_isOn) { mf.TimedMessageBox(2000, "NTRIP also enabled", "NTRIP is also enabled, diabling it"); Properties.Settings.Default.setNTRIP_isOn = false; } // Save radio channels Properties.Settings.Default.setRadio_Channels = _channels; Properties.Settings.Default.Save(); Close(); mf.ConfigureNTRIP(); }
private void btnGetIP_Click(object sender, EventArgs e) { string actualIP = tboxEnterURL.Text.Trim(); try { IPAddress[] addresslist = Dns.GetHostAddresses(actualIP); tboxCasterIP.Text = ""; tboxCasterIP.Text = addresslist[0].ToString().Trim(); } catch (Exception) { mf.TimedMessageBox(1500, "No IP Located", "Can't Find: " + actualIP); } }
private void btnOpenSerial_Click(object sender, EventArgs e) { if (mf.spRadio != null && mf.spRadio.IsOpen) { mf.spRadio.Close(); mf.spRadio.Dispose(); mf.spRadio = null; } // Setup and open serial port mf.spRadio = new SerialPort(cboxRadioPort.Text, int.Parse(cboxBaud.Text)); btnOpenSerial.Enabled = false; btnCloseSerial.Enabled = true; try { mf.spRadio.Open(); lblCurrentPort.Text = Properties.Settings.Default.setPort_portNameRadio; lblCurrentBaud.Text = Properties.Settings.Default.setPort_baudRateRadio; cboxRadioPort.Enabled = false; cboxBaud.Enabled = false; } catch (Exception ex) { mf.TimedMessageBox(3000, "Error opening port", ex.Message); } }
private void btnGetIP_Click(object sender, EventArgs e) { string actualIP = tboxEnterURL.Text.Trim(); try { IPAddress[] addresslist = Dns.GetHostAddresses(actualIP); if (addresslist != null) { tboxCasterIP.Text = ""; foreach (var addr in addresslist) { if (addr.AddressFamily == AddressFamily.InterNetwork) { tboxCasterIP.Text = addr.ToString().Trim(); } } } else { mf.TimedMessageBox(2500, "No IP Located", "Can't Find: " + actualIP); } } catch (Exception) { mf.TimedMessageBox(1500, "No IP Located", "Can't Find: " + actualIP); } }
private void tboxAutoSteerIP_Validating(object sender, CancelEventArgs e) { if (!CheckIPValid(tboxAutoSteerIP.Text)) { tboxAutoSteerIP.Text = "127.0.0.1"; tboxAutoSteerIP.Focus(); mf.TimedMessageBox(2000, "Invalid IP Address", "Set to 198.162.1.255"); } }