private void ShowFindTreeViewDialog(FindDetails findDetails)
 {
     treeViewFindDialog.FindDetails = findDetails;
     var dialogResult = treeViewFindDialog.ShowDialog();
     if (dialogResult != DialogResult.OK) return;
     dbViewTreeView.Find(treeViewFindDialog.FindDetails);
 }
 public TreeViewFindDialog(Point location)
 {
     InitializeComponent();
     Location = location;
     findDetails = new FindDetails();
     HookEvents();
 }
        public virtual bool DoesNodeMatch(FindDetails findDetails)
        {
            var nodeFound = false;
            var nodeText = Text;
            var findStr = findDetails.FindStr;

            if (CannotMatch(findDetails)) return false;

            if (!findDetails.MatchCase)
            {
                nodeText = nodeText.ToUpper();
                findStr = findStr.ToUpper();
            }

            if (findDetails.MatchWholeString)
            {
                if (nodeText.Equals(findStr))
                {
                    TreeView.SelectedNode = this;
                    EnsureVisible();
                    nodeFound = true;
                }
            }
            else
            {
                if (nodeText.Contains(findStr))
                {
                    TreeView.SelectedNode = this;
                    EnsureVisible();
                    nodeFound = true;
                }
            }
            return nodeFound;
        }
 public void Find(FindDetails findDetails)
 {
     recentFindDetails = findDetails;
     var dbNode = (IDBNode) rootNode;
     var nodeFound = dbNode.FindNext(findDetails);
     if (!nodeFound)
         MessageBox.Show("Unable to find the specified DB element", "Find", MessageBoxButtons.OK,
                         MessageBoxIcon.Asterisk);
 }
 public override bool FindPrevious(FindDetails findDetails)
 {
     if (!findDetails.FindTables) return false;
     foreach (var node in NodesInReverse)
     {
         var dbNode = (IDBNode) node;
         if (dbNode.DoesNodeMatch(findDetails)) return true;
     }
     return false;
 }
 public override bool FindNext(FindDetails findDetails)
 {
     if (!findDetails.FindViews) return false;
     foreach (var node in Nodes)
     {
         var dbNode = (IDBNode) node;
         if (dbNode.DoesNodeMatch(findDetails)) return true;
     }
     return false;
 }
 public override bool FindPrevious(FindDetails findDetails)
 {
     var nodeFound = false;
     foreach (var node in NodesInReverse)
     {
         var dbNode = (IDBNode) node;
         nodeFound = dbNode.FindPrevious(findDetails);
         if (nodeFound) break;
     }
     return nodeFound;
 }
 public override bool FindNext(FindDetails findDetails)
 {
     var nodeFound = false;
     foreach (var node in Nodes)
     {
         var dbNode = (IDBNode) node;
         nodeFound = dbNode.FindNext(findDetails);
         if (nodeFound) break;
     }
     return nodeFound;
 }
 public override bool FindPrevious(FindDetails findDetails)
 {
     var nodeFound = false;
     var currentNode = this;
     while (!nodeFound && currentNode.PrevNode != null)
     {
         var dbNode = (IDBNode) currentNode.PrevNode;
         nodeFound = dbNode.DoesNodeMatch(findDetails);
         currentNode = (PackageNode) dbNode;
     }
     return nodeFound;
 }
Exemplo n.º 10
0
 public override bool FindNext(FindDetails findDetails)
 {
     var nodeFound = false;
     var currentNode = this;
     while (!nodeFound && currentNode.NextNode != null)
     {
         var dbNode = (IDBNode) currentNode.NextNode;
         nodeFound = dbNode.DoesNodeMatch(findDetails);
         currentNode = (TableNode) dbNode;
     }
     return nodeFound;
 }
 public override bool FindPrevious(FindDetails findDetails)
 {
     if (!IsConnectionOpen) return false;
     var nodeFound = false;
     if (findDetails.FindViews)
     {
         var tablesNode = (IDBNode) Nodes[2];
         nodeFound = tablesNode.FindPrevious(findDetails);
     }
     if (findDetails.FindPkgs && !nodeFound)
     {
         var pkgsNode = (IDBNode) Nodes[1];
         nodeFound = pkgsNode.FindPrevious(findDetails);
     }
     if (findDetails.FindTables && !nodeFound)
     {
         var viewsNode = (IDBNode) Nodes[0];
         nodeFound = viewsNode.FindPrevious(findDetails);
     }
     return nodeFound;
 }
 public virtual bool FindPrevious(FindDetails findDetails)
 {
     return false;
 }
 public virtual bool FindNext(FindDetails findDetails)
 {
     return false;
 }
 private bool CannotMatch(FindDetails findDetails)
 {
     var tag = (NodeType) Tag;
     var canMatch = true;
     if (tag == NodeType.TABLE && !findDetails.FindTables) canMatch = false;
     if (tag == NodeType.PKG && !findDetails.FindPkgs) canMatch = false;
     if (tag == NodeType.VIEW && !findDetails.FindViews) canMatch = false;
     return !canMatch;
 }