private void cbDialFreq_SelectedIndexChanged(object sender, EventArgs e) { band = WsprBands.GetBands()[cbDialFreq.SelectedIndex]; settings.wsprBandIndex = cbDialFreq.SelectedIndex; settings.Save(); UpdateVerticalScale(); }
public FormMain() { InitializeComponent(); if (LicenseManager.UsageMode == LicenseUsageMode.Designtime) { return; } settings = File.Exists("settings.xml") ? ProgramSettings.Load("settings.xml") : new ProgramSettings(); lblVersion.Text = $"FSKview {version.Major}.{version.Minor}.{version.Build}"; // start in center of screen occupying 80% of its height Height = (int)(Screen.FromControl(this).Bounds.Height * .8); Location = new Point( x: Screen.FromControl(this).Bounds.Width / 2 - Width / 2, y: Screen.FromControl(this).Bounds.Height / 2 - Height / 2); // pre-populate listboxes cbWindow.Items.AddRange(FftSharp.Window.GetWindowNames()); cmaps = Spectrogram.Colormap.GetColormaps(); cbColormap.Items.AddRange(cmaps.Select(x => x.Name).ToArray()); cbDialFreq.Items.AddRange(WsprBands.GetBands().Select(x => $"{x.name}: {x.dialFreq:N0} Hz").ToArray()); // pre-select items based on saved settings audioControl1.SelectDevice(settings.audioDeviceIndex); cbWindow.SelectedIndex = cbWindow.Items.IndexOf(settings.window); cbColormap.SelectedIndex = cbColormap.Items.IndexOf(settings.colormap); cbDialFreq.SelectedIndex = settings.wsprBandIndex; cbWspr.Checked = settings.isWsprEnabled; cbFTP.Checked = settings.isFtpEnabled; nudBrightness.Value = (decimal)settings.brightness; // select on load ActiveControl = cbColormap; }