public Config(string name, ECGConversion.ECGConfig config) { // // Required for Windows Form Designer support // InitializeComponent(); this.Text += name; _Config = config; }
public Config(string name, ECGConversion.ECGConfig config, ECGConversion.ECGConfig.CheckConfigFunction ccf) : this(name, config) { _CheckConfig = ccf; }
private void Config_Load(object sender, System.EventArgs e) { int nrItems = (_Config == null) ? 0 : _Config.NrConfigItems; if (nrItems <= 0) { Close(); return; } _OldConfig = _Config.Clone(true); int pos = 0; int i = 0; for (; i < nrItems; i++) { string name; bool must; _Config.getConfigItem(i, out name, out must); if (name != null) { TextBox tb = new TextBox(); tb.Name = name; tb.Text = _Config[name]; tb.TextChanged += new EventHandler(tb_TextChanged); tb.TabIndex = i; pos += (tb.Height >> 1); tb.Top = pos; tb.Left = (Width >> 1); tb.Width = (Width >> 1) - 10; Label label = new Label(); label.AutoSize = true; label.TextAlign = ContentAlignment.MiddleLeft; label.Name = "label" + name; label.Text = name; if (must) { label.Text += " *"; } label.Top = pos; label.Left = 5; label.Height = tb.Height; this.Controls.Add(tb); this.Controls.Add(label); pos += (tb.Height); } } pos += (buttonOK.Height >> 1); buttonCancel.Top = pos; buttonCancel.TabIndex = i++; buttonOK.Top = pos; buttonOK.TabIndex = i++; this.Height = buttonOK.Bottom + (buttonOK.Height >> 1) + 20; buttonOK.Enabled = _CheckConfig == null?_Config.ConfigurationWorks() : _CheckConfig(); }