Exemple #1
0
        public void PointToNode()
        {
            // This is the node to point to, might change, see comments
            // below.
            BrowserTreeNode node = this;
            TreeListView    tree = (TreeListView)TreeView;

            if (!IsVisible)
            {
                // Ensure visible may cause a node above us to
                // be Invalidated() and therefore leaving this
                // node as an orphan.  Should this happen, we need to
                // Find the correct node.
                String savePath = FullPath;
                EnsureVisible();
                // We got invalidated, refind the right node by name
                if (TreeView == null)
                {
                    node = (BrowserTreeNode)tree.FindNodeByFullPath(savePath);
                    // Should not happen
                    if (node == null)
                    {
                        ErrorDialog.Show("(bug) node " + savePath
                                         + " not found in PointToNode",
                                         "Error Finding Node",
                                         MessageBoxIcon.Error);
                        return;
                    }
                }
            }
            // If the node was previously selected, we need to
            // force the selection processing again because focus
            // may have gone elsewhere requiring the detail panel to
            // get reset.  Need a better way to handle this.
            if (tree.SelectedNode == node)
            {
                DetailPanel.Clear();
                node.Select();
            }
            tree.SetSelectedNode(node);
            tree.Focus();
        }