/// <summary> /// 填充信息 /// </summary> /// <param name="listFriPub"></param> /// <param name="listFriPro"></param> /// <param name="listMyPub"></param> public static void FillProvideMessage(ref ListBox listFriPub, ref ListBox listFriPro, ref ListBox listMyPub) { //先填充自己的公布 List <TMessages> list = BLLControl.GetPublishMessage(new List <string>() { BLLControl.GetValidator().VssID }, 500); listMyPub.Items.Clear(); foreach (TMessages msg in list) { DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddSeconds(msg.ProvideTime); string sItem = dtStart.ToShortDateString() + " " + dtStart.ToShortTimeString() + " From App : " + msg.FromApp; sItem += " Publish A File : [ " + msg.FileOject.FileId + " ]"; sItem += " Size : " + msg.FileOject.FileSize + " Kind : " + msg.FileOject.FileKind.ToString(); listMyPub.Items.Add(sItem); } //找自己关注的人列表,然后拉取他们的公开发布。 List <string> listFriend = BLLControl.GetFocusList(); if (listFriend.Count != 0) { list = BLLControl.GetPublishMessage(listFriend, 500); listFriPub.Items.Clear(); foreach (TMessages msg in list) { DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddSeconds(msg.ProvideTime); string sItem = dtStart.ToShortDateString() + " " + dtStart.ToShortTimeString() + " From App : " + msg.FromApp; sItem += " Publish A File : [ " + msg.FileOject.FileId + " ]"; sItem += " Size : " + msg.FileOject.FileSize + " Kind : " + msg.FileOject.FileKind.ToString(); listFriPub.Items.Add(sItem); } } //找别人单独授权我的列表 list = BLLControl.GetProvideMessage(500); listFriPro.Items.Clear(); foreach (TMessages msg in list) { DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddSeconds(msg.ProvideTime); string sItem = dtStart.ToShortDateString() + " " + dtStart.ToShortTimeString() + " From App : " + msg.FromApp; sItem += " Publish A File : [ " + msg.FileOject.FileId + " ]"; sItem += " Size : " + msg.FileOject.FileSize + " Kind : " + msg.FileOject.FileKind.ToString(); listFriPro.Items.Add(sItem); } }
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(); } }