/// <summary> /// 停止执行任务,按钮回复默认状态,关闭子窗口 /// </summary> private void EndExecute() { newTaskButton.Enabled = true; clickModeButton.Enabled = true; quickModeButton.Enabled = true; stopButton.Enabled = false; cleanTaskButton.Enabled = true; cleanLogButton.Enabled = true; loopCheckBox.Enabled = true; _cts?.Cancel(); //取消异步task OwnedForms.FirstOrDefault()?.Close(); //关闭浏览器 }
/// <summary> /// 按下F12显示或关闭浏览器窗口。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainForm_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode != Keys.F12) { return; } if (!(OwnedForms.FirstOrDefault() is BrowserForm browser)) { return; } browser.ToggleVisible(); _isShowBrowser = browser.Visible; }
private void Queryes_Click(object sender, EventArgs e) { Form form = OwnedForms.FirstOrDefault(f => f is Queryes); if (form != null) { form.WindowState = FormWindowState.Normal; form.Activate(); return; } form = new Queryes(); form.Show(this); }
public DataTableView FindView(string name) { int ind = tabFormControl1.TabPages.IndexOfKey(name); if (ind != -1) { tabFormControl1.SelectedIndex = ind; return(tabFormControl1.TabPages[ind].Controls[0] as DataTableView); } var q = OwnedForms.FirstOrDefault(f => f.Name == name); if (q != null) { q.Select(); return(q.Controls[0] as DataTableView); } return(null); }