private void executeToolStripMenuItem_Click(object sender, EventArgs e) { if (tabControl1.SelectedTab != null) { UCQuery query = tabControl1.SelectedTab.Controls[0] as UCQuery; if (query != null) { query.Execute(this.cmbDBPath.Text); } } }
private void newQueryToolStripMenuItem_Click(object sender, EventArgs e) { UCQuery uq = new UCQuery(); uq.Initialize(this.cmbDBPath.Text); uq.Dock = DockStyle.Fill; TabPage tab = new TabPage("NewQuery1"); tab.Controls.Add(uq); this.tabControl1.TabPages.Add(tab); this.tabControl1.SelectedTab = tab; executeToolStripMenuItem.Enabled = true; btnExecuteToolbar.Enabled = true; }
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) { if (tabControl1.SelectedTab != null) { UCQuery query = tabControl1.SelectedTab.Controls[0] as UCQuery; if (query != null) { query.SaveAs(); string fileName = query.GetFile(); if (fileName != null) { string fname = Path.GetFileName(fileName); this.tabControl1.SelectedTab.Text = fname; } } } }
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { if (tabControl1.SelectedTab != null) { UCQuery query = tabControl1.SelectedTab.Controls[0] as UCQuery; if (query != null) { //query.Execute(); executeToolStripMenuItem.Enabled = true; btnExecuteToolbar.Enabled = true; } else { executeToolStripMenuItem.Enabled = false; btnExecuteToolbar.Enabled = false; } tabControl1.SelectedTab.ToolTipText = tabControl1.SelectedTab.Text; } }
private void openLINQToolStrip_Click(object sender, EventArgs e) { OpenFileDialog opf = new OpenFileDialog(); opf.Filter = "(*.linq)|*.linq|All Files(*.*)|*.*"; opf.InitialDirectory = Environment.CurrentDirectory; if (opf.ShowDialog() == DialogResult.OK) { using (StreamReader sr = new StreamReader(opf.FileName)) { string s = sr.ReadToEnd(); UCQuery uq = new UCQuery(); uq.Initialize(this.cmbDBPath.Text); uq.Dock = DockStyle.Fill; TabPage tab = new TabPage(Path.GetFileName(opf.FileName)); tab.Controls.Add(uq); this.tabControl1.TabPages.Add(tab); this.tabControl1.SelectedTab = tab; uq.SetText(s, opf.FileName); executeToolStripMenuItem.Enabled = true; btnExecuteToolbar.Enabled = true; } } }