Beispiel #1
0
 public void SelectNode(IRealTreeNode node, SelectNodeFlags flags)
 {
     if (node == null)
     {
         tree.SelectedNode = null;
         return;
     }
     tree.SelectedNode = (DATreeNode)node;
     if ((flags & SelectNodeFlags.Expand) != 0)
     {
         node.ExpandNode();
     }
     if ((flags & SelectNodeFlags.FocusTree) != 0)
     {
         tree.Focus();
         if (TreeBehaviour.InfluenceGlobalTrees)
         {
             HTree.CallFocusedNodeChanged();
         }
     }
     if ((flags & SelectNodeFlags.ScrollInView) != 0)
     {
         node.EnsureVisibleNode();
     }
 }
Beispiel #2
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            m_lastDoubleClick = DateTime.Now;
            var ao = SelectedAppObject;

            if (ao == null)
            {
                return;
            }
            switch (DoubleClickAction)
            {
            case DoubleClickActionType.DefaultAction:
                ao.DefaultAction();
                break;

            case DoubleClickActionType.OpenInTree:
            {
                var dash = GetParentDashboard();
                if (dash != null && dash.WinId != null && MainWindow.Instance.HasContent(dash.WinId))
                {
                    ao.OpenTheBestDashboard();
                    return;
                }
                else if (ao.GetTreePath() != null)
                {
                    HTree.CallSelectNode(ao.GetTreePath(), SelectNodeFlags.FocusTree | SelectNodeFlags.ScrollInView);
                }
            }
            break;
            }
        }
Beispiel #3
0
        public static ITreeNode GetFocusedNode()
        {
            var nodes = new List <ITreeNode>();

            HTree.CallGetFocusedNode(nodes);
            if (nodes.Count > 0)
            {
                return(nodes[0]);
            }
            return(null);
        }
Beispiel #4
0
 private void tree_Enter(object sender, EventArgs e)
 {
     m_focused2 = true;
     if (TreeEnter != null)
     {
         TreeEnter(sender, e);
     }
     if (TreeBehaviour.InfluenceGlobalTrees)
     {
         HTree.CallFocusedNodeChanged();
     }
 }
Beispiel #5
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            var repls = new List <Tuple <string, string> >();

            configSelectionFrame1.Root.GetReplacePaths(repls);
            configSelectionFrame1.Root.CopyCheckedTo(m_dstFs, true, repls);
            Close();

            // refresh all what we can refresh...
            HTree.CallRefreshRoot();
            HFavorites.CallChanged();

            StdDialog.ShowInfo("s_config_imported");

            //if (MessageBox.Show("s_conf_imported_restart_recomended_restart_now", "DatAdmin", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            //{
            //    MainWindow.Instance.CloseMainWindow();
            //    Core.ExecuteAfterFinalize = Core.FullExeName;
            //}
        }
Beispiel #6
0
 private void daTreeView1_ActiveNodeChange(object sender, EventArgs e)
 {
     HTree.CallFocusedNodeChanged();
 }
Beispiel #7
0
 private void AfterDeleteNode(ITreeNode node)
 {
     HTree.CallAfterDeleteNode(node);
 }
Beispiel #8
0
        void labPathRoot_Click(object sender, EventArgs e)
        {
            var lab = (LinkLabel)sender;

            HTree.CallSelectNode(lab.Tag.ToString(), SelectNodeFlags.FocusTree | SelectNodeFlags.ScrollInView);
        }
Beispiel #9
0
        //public override void DragDrop(ITreeNode draggingNode)
        //{
        //    if (draggingNode is FileTreeNodeBase || draggingNode is VirtualFileTreeNodeBase)
        //    {
        //        ContextMenuStripEx menu = new ContextMenuStripEx();
        //        var copy = menu.Items.Add(Texts.Get("s_copy_here"));
        //        copy.Click += (sender, ev) => DragDropFile(draggingNode, CopyFileMode.Copy);
        //        var move = menu.Items.Add(Texts.Get("s_move_here"));
        //        move.Click += (sender, ev) => DragDropFile(draggingNode, CopyFileMode.Move);
        //        menu.ShowOnCursor();
        //    }
        //}

        private void DoGetChildren()
        {
            var loaded = new Dictionary <string, ITreeNode>();
            List <ITreeNode> result = new List <ITreeNode>();
            var files = m_folder.LoadFiles();

            HTree.CallFilterFolderFiles(files);
            files.Sort((a, b) => a.FullPath.Length - b.FullPath.Length);
            foreach (IVirtualFile file in files)
            {
                if (PrefixTest(loaded, file))
                {
                    continue;
                }

                ITreeNode node = null;
                if (file.DiskPath != null)
                {
                    if (DeletedFileRegistrer.DeletedInvisible.Contains(file.DiskPath.ToLower()))
                    {
                        continue;
                    }
                    if (DeletedFileRegistrer.DeletedVisible.Contains(file.DiskPath.ToLower()))
                    {
                        node = new DeletedPathNode(this, file.DiskPath);
                    }
                }

                try
                {
                    if (node == null)
                    {
                        node = NodeFactory.FromFile(this, file);
                    }
                }
                catch
                {
                    node = new UnknownVirtualFileNode(this, new UnknownFileHandler {
                        FileObject = file
                    });
                }
                //if (node == null) node = new UnknownVirtualFileNode(this, file);

                if (node != null)
                {
                    result.Add(node);
                }
                if (node is VirtualFileTreeNodeBase)
                {
                    loaded[file.Name] = (VirtualFileTreeNodeBase)node;
                }
            }

            var dirs = m_folder.LoadFolders();

            dirs.Sort((a, b) => a.FullPath.Length - b.FullPath.Length);

            foreach (var dir in dirs)
            {
                //if (System.IO.Path.GetFileName(dir).ToLower().StartsWith(".private")) continue;
                if (dir.DiskPath != null && IOTool.IsVersioningDirectory(dir.DiskPath))
                {
                    continue;
                }
                if (PrefixTest(loaded, dir))
                {
                    continue;
                }

                ITreeNode node = null;
                if (dir.DiskPath != null)
                {
                    if (DeletedFileRegistrer.DeletedInvisible.Contains(dir.DiskPath.ToLower()))
                    {
                        continue;
                    }
                    if (DeletedFileRegistrer.DeletedVisible.Contains(dir.DiskPath.ToLower()))
                    {
                        node = new DeletedPathNode(this, dir.DiskPath);
                    }
                }

                if (node == null)
                {
                    var newnode = new VirtualFolderTreeNode(this, dir, dir.Name);
                    loaded[dir.Name] = newnode;
                    node             = newnode;
                }
                result.Add(node);
            }

            result.Sort(CompareNodes);
            PostprocessChildren(result);
            m_children = result.ToArray();
        }