protected void LoadConfig() { var config = GlobalInfo.ReadConfig(); if (config != null) { txtStockCode.Text = config.StockCode; txtUpdateInterval.Text = config.UpdateInterval.ToString(); txtDiff.Text = config.Diff.HasValue ? config.Diff.ToString() : string.Empty; txtDiffSeconds.Text = config.DiffSeconds.HasValue ? config.DiffSeconds.ToString() : string.Empty; cmbType.SelectedItem = config.DiffType; ckAlert.Checked = config.AlertEnabled; } else { ckAlert.Checked = false; } ckAlert_CheckedChanged(ckAlert, null); }
public StartForm() { InitializeComponent(); config = GlobalInfo.ReadConfig(); if (config == null) { config = new Config() { StockCode = "sh000001", UpdateInterval = 5 }; } this.MouseUp += StartForm_MouseUp; foreach (Control c in this.Controls) { c.MouseUp += StartForm_MouseUp; } }