Ejemplo n.º 1
0
        /// <summary>
        /// Return a copy of the QueryForm object, with separate connection and browser objects
        /// </summary>
        public frmDocument Clone()
        {
            simpleDebug.dump();
            // Make a copy of the QueryForm's DbClient object.  We can't use the same object
            // object because this would mean sharing the same connection, preventing concurrent queries.
            DbClient d = DbClient.Clone();

            if (d.Connect())
            {
                d.Database = DbClient.Database;
                // We have to duplicate the Browser too, since it has a reference to the DbClient object.
                IBrowser b = null;
                if (Browser != null)
                {
                    try { b = Browser.Clone(d); }
                    catch { }
                }
                frmDocument newQF = new frmDocument(d, b, HideBrowser, "MSSQL");
                newQF.ResultsInText = ResultsInText;
                return(newQF);
            }
            else
            {
                MessageBox.Show("Unable to connect: " + d.Error, "zenQuery", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
        }
Ejemplo n.º 2
0
        private void DoConnect()
        {
            simpleDebug.dump();
            ConnectForm cf = new ConnectForm();

            if (cf.ShowDialog() == DialogResult.OK)
            {
                //MK
                frmDocument qf = new frmDocument(cf.DbClient, cf.Browser, cf.LowBandwidth, "MSSQL");
                qf.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.Document;
                qf.Text     = "Query" + ++_newDocumentCount;
                qf.Show(dockPanel);
            }
        }
Ejemplo n.º 3
0
        private void tsNew_Click(object sender, EventArgs e)
        {
            simpleDebug.dump();
            if (IsChildActive())
            {
                // Change the cursor to an hourglass while we're doing this, in case establishing the
                // new connection takes some time.
                Cursor oldCursor = Cursor;
                Cursor = Cursors.WaitCursor;
                frmDocument newQF = GetQueryChild().Clone();
                if (newQF != null)                                                                                                                              // could be null if new connection failed
                {
                    newQF.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.Document;
                    newQF.Text     = "Query" + ++_newDocumentCount;

                    newQF.Show(dockPanel);
                    // This is so that we can update the toolbar and menu as the state of the QueryForm changes.
                    //newQF.PropertyChanged += new EventHandler(ChildPropertyChanged);
                }
                Cursor = oldCursor;
            }
        }
Ejemplo n.º 4
0
        private void btnsearch_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtsearch.Text.Trim()))
            {
                MessageBox.Show(this, "You must provide search string.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtsearch.Focus();
                return;
            }

            foreach (Form frmChild in this.MdiChildren)
            {
                if (frmChild.Name == "frmDocument")
                {
                    frmDocument y        = (frmDocument)frmChild;
                    TreeView    treeView = y.tree;

                    treeView.BeginUpdate();
                    treeView.Nodes.Clear();
                    y.PopulateBrowser();

                    if (this.txtsearch.Text != string.Empty)
                    {
                        foreach (TreeNode _parentNode in treeView.Nodes)
                        {
                            int nodescount = _parentNode.Nodes.Count;

                            for (int i = 0; i < nodescount; i++)
                            {
                                if (nodescount == 0)
                                {
                                    break;
                                }

                                TreeNode x = _parentNode.Nodes[i];
                                if (x == null)
                                {
                                    break;
                                }
                                if (x.Text.IndexOf(this.txtsearch.Text, StringComparison.InvariantCultureIgnoreCase) == -1)
                                {
                                    _parentNode.Nodes[i].Remove();
                                    i--;
                                    nodescount--;
                                }
                            }
                        }
                    }

                    //enables redrawing tree after all objects have been added
                    treeView.EndUpdate();
                }
            }

            Cursor oldCursor = Cursor;

            Cursor = Cursors.WaitCursor;

            //frmDocument qf = new frmDocument(cf.DbClient, cf.Browser, cf.LowBandwidth, "MSSQL");
            //qf.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.Document;
            //qf.Text = "Query" + ++_newDocumentCount;
            //qf.Show(dockPanel);


            frmSearch c = new frmSearch(chkobjecttext.Checked, txtsearch.Text, GetQueryChild().DbClient);

            c.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.Document;
            c.Text     = "Search Result" + ++_newDocumentCount;
            c.Show(dockPanel);
            //c.Show();
            Cursor = oldCursor;
        }