예제 #1
0
        private void UpdateTV(KfsStatusPath path, KTreeNode node)
        {
            KTreeNode self = new KTreeNode(path, m_lvImageListMgr, SrcApp.Helper);
            self.Name = path.Path;

            node.Nodes.Add(self);

            foreach (KfsStatusPath p in path.ChildTree.Values)
            {
                if (p.Status == PathStatus.Directory)
                    UpdateTV(p, self);
            }

            KfsLocalDirectory localDir = SrcApp.Share.LocalView.GetObjectByPath(path.Path) as KfsLocalDirectory;
            KfsServerDirectory serverDir = SrcApp.Share.ServerView.GetObjectByPath(path.Path) as KfsServerDirectory;
            if (localDir != null && localDir.ExpandedFlag ||
                serverDir != null && serverDir.ExpandedFlag)
            {
                self.Expand();
            }
        }
예제 #2
0
        private void UpdateTV()
        {
            Logging.Log("UpdateTV");
            tvFileTree.Nodes.Clear();
            bool updateTvFlag = false;
            bool updateLvFlag = true;

            m_ignoreExpandFlag = true;

            if (CanWorkOffline())
            {
                // The status view is not up to date, request an update.
                if (SrcApp.Share.StatusView.Root == null)
                    SrcApp.Share.RequestStatusViewUpdate("UpdateTV()");

                // We need to update the tree view.
                else
                    updateTvFlag = true;
            }

            if (updateTvFlag)
            {
                KfsStatusPath rootStatusPath = SrcApp.Share.StatusView.Root;
                UpdateBackgroundImage();
                // Add the TV root.
                KTreeNode root = new KTreeNode(rootStatusPath, m_lvImageListMgr, SrcApp.Helper);

                root.Name = "";

                tvFileTree.Nodes.Add(root);

                foreach (KfsStatusPath p in rootStatusPath.ChildTree.Values)
                {
                    if (p.Status == PathStatus.Directory) UpdateTV(p, root);
                }

                root.Expand();

                if (Settings.SelectedDir == "")
                {
                    tvFileTree.SelectedNode = tvFileTree.Nodes[0];
                }
                else
                {
                    TreeNode[] nodes = tvFileTree.Nodes.Find(Settings.SelectedDir, true);

                    if (nodes.Length == 1)
                        tvFileTree.SelectedNode = nodes[0];
                    else
                    {
                        // The initially selected folder was moved or deleted.
                        // Select the root. This causes an implicit update.
                        tvFileTree.SelectedNode = root;
                        updateLvFlag = false;
                    }
                }

                if (Settings.IsSelectedDirExpanded)
                    tvFileTree.SelectedNode.Expand();
            }

            m_ignoreExpandFlag = false;

            if (updateLvFlag) UpdateLV();
        }