void updateUI() { tbSpeed.Value = (10 - (int)Math.Round(Math.Log(scope.Speed) / Math.Log(2))); if (chkVoltage != null) { chkVoltage.Checked = scope.ShowV; } chkScale.Checked = scope.ShowScale; chkPeak.Checked = scope.ShowMax; chkNegPeak.Checked = scope.ShowMin; chkFreq.Checked = scope.ShowFreq; chkSpectrum.Checked = scope.ShowFFT; chkRms.Checked = scope.ShowRMS; chkRms.Text = "Show RMS Average"; if (rbVbe != null) { if (rbVbe.Checked) { scope.ShowingValue(Scope.VAL.VBE); } if (rbVbc.Checked) { scope.ShowingValue(Scope.VAL.VBC); } if (rbVce.Checked) { scope.ShowingValue(Scope.VAL.VCE); } } lblManualScale.Text = "Scale (Max Value)" + " (V)"; txtManualScale.Text = ElementInfoDialog.UnitString(null, scope.ScaleValue); chkManualScale.Checked = scope.LockScale; txtManualScale.Enabled = scope.LockScale; chkLogSpectrum.Checked = scope.LogSpectrum; chkLogSpectrum.Enabled = scope.ShowFFT; setScopeSpeedLabel(); /* if you add more here, make sure it still works with transistor scopes */ }
void buildDialog() { int i; int idx; vp.SuspendLayout(); for (i = 0; ; i++) { einfos[i] = elm.GetElementInfo(i); if (einfos[i] == null) { break; } var ei = einfos[i]; if (!ei.CanCreateAdjustable()) { continue; } var adj = findAdjustable(i); string name = ei.Name; idx = vp.Controls.IndexOf(hp); /* remove HTML */ var rg = new Regex("<[^>]*>"); name = rg.Replace(name, ""); ei.CheckBox = new CheckBox() { AutoSize = true, Text = name, Checked = adj != null }; ctrlInsert(vp, ei.CheckBox, idx++); ei.CheckBox.CheckedChanged += new EventHandler((sender, e) => { itemStateChanged(sender); }); if (adj != null) { ctrlInsert(vp, new Label() { TextAlign = ContentAlignment.BottomLeft, Text = "Min Value" }, idx++); ei.MinBox = new TextBox() { Text = ElementInfoDialog.UnitString(ei, adj.MinValue) }; ctrlInsert(vp, ei.MinBox, idx++); ctrlInsert(vp, new Label() { TextAlign = ContentAlignment.BottomLeft, Text = "Max Value" }, idx++); ei.MaxBox = new TextBox() { Text = ElementInfoDialog.UnitString(ei, adj.MaxValue) }; ctrlInsert(vp, ei.MaxBox, idx++); ctrlInsert(vp, new Label() { TextAlign = ContentAlignment.BottomLeft, Text = "Label" }, idx++); ei.LabelBox = new TextBox() { Text = adj.SliderText }; ctrlInsert(vp, ei.LabelBox, idx++); } } vp.ResumeLayout(false); einfocount = i; }