private void 打开ToolStripMenuItem_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { var s = openFileDialog1.FileName; var sb = new StringBuilder("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="); sb.Append(s); //MessageBox.Show(sb.ToString()); DbPathLabel.Text = s; ConfigPump.DbConstr = sb.ToString(); PHelper.GetAllPumpId(); tabControl1.Enabled = true; // MessageBox.Show(ConfigPump.ReadDbPumpidList.ToString()); } }
private void CalcBtn(object sender, EventArgs e) { ConfigPump.Pumpinfos.Clear();//计算前先把内存中的PumpInfos全部清空,这里不存在pumpinfos为null的情况 if (ConfigPump.DbConstr == null) { MessageBox.Show(Resources.Main_button1_Click_请先选择数据库文件_); return; } PHelper.GetAllPumpId(); flowLayoutPanel1.Controls.Clear(); foreach (var pumpid in ConfigPump.ReadDbPumpidList) { var pump = PHelper.GetPumpInfo(pumpid); ConfigPump.Pumpinfos.Add(pump); var pc = new PumpContorl(pump); flowLayoutPanel1.Controls.Add(pc); } }