private void meterReadingToolStripMenuItem_Click(object sender, EventArgs e) { var m = new MeterReading(_currentUser); if (!OpenForms <MeterReading>()) { m.MdiParent = this; m.Show(); } }
private void TreeViewMeters_DoubleClick(object sender, EventArgs e) { TreeNode node = TreeViewMeters.SelectedNode; //MessageBox.Show($"{node.Parent.Text} {node.Text}"); switch (node.Text) { case "Info": var m = new Meter(_currentUser); if (!OpenForms <Meter>()) { m.MdiParent = this; m.Show(); m.TextBoxSearch.Text = node.Parent.Text; m.ButtonSearch.PerformClick(); } break; case "Reading": var mr = new MeterReading(_currentUser); if (!OpenForms <MeterReading>()) { mr.MdiParent = this; mr.Show(); mr.TextBoxSearch.Text = node.Parent.Text; mr.ButtonSearch.PerformClick(); mr.DataGridViewMeterReading.FirstDisplayedScrollingRowIndex = mr.DataGridViewMeterReading.RowCount - 1; // select new row mr.DataGridViewMeterReading.Rows[mr.DataGridViewMeterReading.Rows.Count - 1].Selected = true; mr.DataGridViewMeterReading_SelectionChanged(this, new EventArgs()); } break; case "GPS": var g = new GPS(); if (!OpenForms <GPS>()) { g.MdiParent = this; g.Show(); } break; default: break; } }