示例#1
0
 /// <summary>
 /// 粘帖数据
 /// </summary>
 public static void PasteNode()
 {
     if (CutTemp == null)
     {
         return;
     }
     AddNode((FileTreeNode)CutTemp.Clone());
     BLLControl.SaveDirectoryInfo();
 }
示例#2
0
        public static void FillFileTreeByTimerLoadingMessage(ref TreeView treeView)
        {
            //先填充自己的公布
            List <TMessages> list = BLLControl.GetPublishMessage(new List <string>()
            {
                BLLControl.GetValidator().VssID
            }, 500);
            List <TMessages> provideItems = BLLControl.GetProvideItems(500);

            list.AddRange(provideItems);
            TreeNode theTreeNode = treeView.Nodes[1];

            PublishFolder.SubNodes.Clear();
            foreach (TMessages msg in list)
            {
                PublishFolder.SubNodes.Add(CreateTreeNodeByMessage(msg));
            }
            //验证数据是否变化,再确定是否替换。
            bool needRefresh = true;

            if (tempPublishFolder != null)
            {
                if (CompareFileTreeNode(tempPublishFolder, PublishFolder))
                {
                    needRefresh = false;
                }
            }
            if (needRefresh)
            {
                theTreeNode.Nodes.Clear();
                SetTreeNodeByObject(ref theTreeNode, PublishFolder);
                tempPublishFolder = (FileTreeNode)PublishFolder.Clone();
            }


            //填充收听表
            Dictionary <string, List <TMessages> > dictMsg;

            List <string> friList = BLLControl.GetFocusList();

            if (friList.Count != 0)
            {
                list    = BLLControl.GetPublishMessage(friList, 500);
                dictMsg = new Dictionary <string, List <TMessages> >();
                foreach (TMessages msg in list)
                {
                    if (!dictMsg.ContainsKey(msg.FromVssId))
                    {
                        dictMsg.Add(msg.FromVssId, new List <TMessages>());
                    }
                    dictMsg[msg.FromVssId].Add(msg);
                }
                theTreeNode = treeView.Nodes[2];
                FocusFolder.SubNodes.Clear();
                foreach (string key in dictMsg.Keys)
                {
                    FileTreeNode folder = new FileTreeNode();
                    folder.SubNodes = new List <FileTreeNode>();
                    folder.FileID   = "0";
                    folder.FileKind = ContentKind.Folder;
                    folder.FileInfo = key + "'s Folder";
                    folder.FileSize = 0;
                    folder.FromApp  = "Vss";
                    folder.NodeName = key;
                    folder.SubNodes = new List <FileTreeNode>();
                    foreach (TMessages msg in dictMsg[key])
                    {
                        folder.SubNodes.Add(CreateTreeNodeByMessage(msg));
                    }
                    FocusFolder.SubNodes.Add(folder);
                }

                //验证数据是否变化,再确定是否替换。
                needRefresh = true;
                if (tempFocusFolder != null)
                {
                    if (CompareFileTreeNode(tempFocusFolder, FocusFolder))
                    {
                        needRefresh = false;
                    }
                }

                if (needRefresh)
                {
                    theTreeNode.Nodes.Clear();
                    SetTreeNodeByObject(ref theTreeNode, FocusFolder);
                    tempFocusFolder = (FileTreeNode)FocusFolder.Clone();
                }
            }


            //下面填充我Receive的列表

            list    = BLLControl.GetProvideMessage(500);
            dictMsg = new Dictionary <string, List <TMessages> >();
            foreach (TMessages msg in list)
            {
                if (!dictMsg.ContainsKey(msg.FromVssId))
                {
                    dictMsg.Add(msg.FromVssId, new List <TMessages>());
                }
                dictMsg[msg.FromVssId].Add(msg);
            }
            theTreeNode = treeView.Nodes[3];
            ReceiveFolder.SubNodes.Clear();
            foreach (string key in dictMsg.Keys)
            {
                FileTreeNode folder = new FileTreeNode();
                folder.SubNodes = new List <FileTreeNode>();
                folder.FileID   = "0";
                folder.FileKind = ContentKind.Folder;
                folder.FileInfo = key + "'s Folder";
                folder.FileSize = 0;
                folder.FromApp  = "Vss";
                folder.NodeName = key;
                folder.SubNodes = new List <FileTreeNode>();
                foreach (TMessages msg in dictMsg[key])
                {
                    folder.SubNodes.Add(CreateTreeNodeByMessage(msg));
                }
                ReceiveFolder.SubNodes.Add(folder);
            }

            //验证数据是否变化,再确定是否替换。
            needRefresh = true;
            if (tempReceiveFolder != null)
            {
                if (CompareFileTreeNode(tempReceiveFolder, ReceiveFolder))
                {
                    needRefresh = false;
                }
            }

            if (needRefresh)
            {
                theTreeNode.Nodes.Clear();
                SetTreeNodeByObject(ref theTreeNode, ReceiveFolder);
                tempReceiveFolder = (FileTreeNode)ReceiveFolder.Clone();
            }
        }