private void 感器位置ToolStripMenuItem_Click(object sender, EventArgs e) { if (!ValidatePassword()) { return; } placeForm.Reset(); sitesComm.Stop(); PlaceForm pf = new PlaceForm(sites, true); pf.ShowDialog(); sites.Save(new DbClient()); placeForm.Reset(); //ssForm.RefreshSites(); sitesComm.Start(); }
private void MainForm_Load(object sender, EventArgs e) { if (!DbClient.TestConnect()) { MessageBox.Show("数据库连接失败,如果是首次运行,请先配置数据库连接。"); new SetConnForm().ShowDialog(); return; } try { Sites.Load(out sites, new DbClient()); } catch (System.Exception ex) { MessageBox.Show("加载分站配置失败,请检查据库连接。错误信息:" + ex.Message); sites = new Sites(); } //UiChange.Load(); //queryForm = new QueryForm(sites); ssForm = new SitesStateForm(sites); placeForm = new PlaceForm(sites, false); sensorListForm = new SensorListForm(sites); abnormalForm = new AbnormalForm(sites); //try //{ // dockPanel.LoadFromXml("DockSettings", GetContentFormPersistString); //} //catch (Exception ex) //{ // //queryForm.Show(this.dockPanel, DockState.Document); // placeForm.Show(this.dockPanel, DockState.Document); // ssForm.Show(this.dockPanel, DockState.Document); sensorListForm.Show(this.dockPanel, DockState.Document); // abnormalForm.Show(this.dockPanel, DockState.Document); //} // string v = UiChange.Get(ssForm.GetKey()); // colCount = v.Length > 0 ? Convert.ToInt32(v) : 1; // toolStripComboBoxCol.SelectedIndex = colCount-1; sitesComm = new SitesComm(sites); sitesComm.Start(); toolStripMenuView.Enabled = true; ToolStripReport.Enabled = true; }