public void AddQueryForm(string title, string text, SqlConnector DataProvider) { MultiQueryForm.QueryForm dlg = new MultiQueryForm.QueryForm(this, DataProvider, text); dlg.ToolTipText = String.Format("{0} - {1} / {2} - {3}", DataProvider.Server, DataProvider.DataBase, ConxGroup, ConxName); dlg.Text = String.Format("{0}", title); dlg.ShowIcon = true; dlg.Show(WorkPanel, WeifenLuo.WinFormsUI.Docking.DockState.Document); }
private void BtnNewQuery_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(CurConStr)) { MessageBox.Show("Select a database connection"); return; } if (CurrentConnection.IsBusy) { return; } if (!CurrentConnection.Loaded) { CurrentConnection.Initialize(LoadingDialogPosition, false); } MultiQueryForm.QueryForm dlg = new MultiQueryForm.QueryForm(this, CurrentConnection); dlg.ToolTipText = String.Format("{0} - {1}", CurrentConnection.Server, CurrentConnection.DataBase); dlg.Text = String.Format("{0} - {1}", ConxGroup, ConxName); dlg.ShowIcon = true; dlg.Show(WorkPanel, WeifenLuo.WinFormsUI.Docking.DockState.Document); }
public void ShowFor(QueryForm parent, TextEditorControl editor, bool replaceMode) { Editor = editor; Parent = parent; _search.ClearScanRegion(); var sm = editor.ActiveTextAreaControl.SelectionManager; if (sm.HasSomethingSelected && sm.SelectionCollection.Count == 1) { var sel = sm.SelectionCollection[0]; if (sel.StartPosition.Line == sel.EndPosition.Line) TxtSearch.Text = sm.SelectedText; else _search.SetScanRegion(sel); } else { // Get the current word that the caret is on Caret caret = editor.ActiveTextAreaControl.Caret; int start = TextUtilities.FindWordStart(editor.Document, caret.Offset); int endAt = TextUtilities.FindWordEnd(editor.Document, caret.Offset); TxtSearch.Text = editor.Document.GetText(start, endAt - start); } //ReplaceMode = replaceMode; this.Owner = (Form)editor.TopLevelControl; this.Show(); TxtSearch.SelectAll(); TxtSearch.Focus(); if (!_highlightGroups.ContainsKey(_editor)) _highlightGroups[_editor] = new HighlightGroup(_editor); HighlightGroup group = _highlightGroups[_editor]; group.ClearMarkers(); }