示例#1
0
        /// <summary>
        /// Load the entire forums tree.
        /// </summary>
        private void LoadForumsTree(TreeNode parent)
        {
            bool showAllTopics = Preferences.StandardPreferences.ShowAllTopics;
            foreach (Folder folder in CIX.FolderCollection.Where(fld => fld.IsRootFolder).OrderBy(fld => fld.Index))
            {
                TopicFolder forumFolder = new TopicFolder(folder) { Name = folder.Name };
                TreeNode node = new TreeNode(folder.Name) { Tag = forumFolder };

                int folderID = folder.ID;
                foreach (Folder topic in CIX.FolderCollection.Where(fld => fld.ParentID == folderID).OrderBy(nm => nm.Index))
                {
                    bool showArchivedTopic = showAllTopics || !topic.IsRecent && topic.Unread > 0;
                    if (showArchivedTopic || topic.IsRecent)
                    {
                        TopicFolder topicFolder = new TopicFolder(topic) { Name = topic.Name };
                        TreeNode subNode = new TreeNode(topicFolder.Name) { Tag = topicFolder };

                        node.Nodes.Add(subNode);
                    }
                }
                parent.Nodes.Add(node);
            }

            // Group special folders at the top
            SmartFolder starredFolder = new SmartFolder
            {
                Name = Resources.Starred,
                Comparator = message => message.Starred,
                Criteria = PredicateBuilder.GetExpression<CIXMessage>(
                    RuleGroupType.All,
                    new List<PredicateBuilder.Filter>
                    {
                        new PredicateBuilder.Filter {
                            PropertyName = "Starred" ,
                            Operation = PredicateBuilder.Op.Equals,
                            Value = true }
                    })
            };
            parent.Nodes.Insert(0, new TreeNode
            {
                Name = Resources.Starred,
                Tag = starredFolder
            });

            SmartFolder draftsFolder = new SmartFolder
            {
                Name = Resources.DraftText,
                Comparator = message => message.IsDraft,
                Criteria = PredicateBuilder.GetExpression<CIXMessage>(
                    RuleGroupType.All,
                    new List<PredicateBuilder.Filter>
                    {
                        new PredicateBuilder.Filter {
                            PropertyName = "RemoteID" ,
                            Operation = PredicateBuilder.Op.GreaterThanOrEqual,
                            Value = int.MaxValue / 2 },
                        new PredicateBuilder.Filter {
                            PropertyName = "PostPending" ,
                            Operation = PredicateBuilder.Op.Equals,
                            Value = false }
                    })
            };
            parent.Nodes.Insert(1, new TreeNode
            {
                Name = Resources.DraftText,
                Tag = draftsFolder
            });

            SmartFolder outboxFolder = new SmartFolder
            {
                Name = Resources.OutboxText,
                Comparator = message => message.IsPending,
                Criteria = PredicateBuilder.GetExpression<CIXMessage>(
                    RuleGroupType.All,
                    new List<PredicateBuilder.Filter>
                    {
                        new PredicateBuilder.Filter {
                            PropertyName = "PostPending" ,
                            Operation = PredicateBuilder.Op.Equals,
                            Value = true }
                    })
            };
            parent.Nodes.Insert(2, new TreeNode
            {
                Name = Resources.OutboxText,
                Tag = outboxFolder
            });

            _allSmartFolders = new List<TreeNode>
            {
                parent.Nodes[0], parent.Nodes[1], parent.Nodes[2]
            };
        }
示例#2
0
        /// <summary>
        /// Reload the list of topics under the given forum folder.
        /// </summary>
        private void ReloadForumTreeFromNode(FolderBase forumFolder)
        {
            TreeNode parent = FindFolder(_forumsTree.Nodes, forumFolder.Name);
            bool showAllTopics = Preferences.StandardPreferences.ShowAllTopics;

            if (parent != null)
            {
                TopicFolder folder = (TopicFolder) forumFolder;
                parent.Nodes.Clear();
                foreach (Folder topic in folder.Folder.Children.OrderBy(nm => nm.Index))
                {
                    bool showArchivedTopic = showAllTopics || !topic.IsRecent && topic.Unread > 0;
                    if (showArchivedTopic || topic.IsRecent)
                    {
                        TopicFolder topicFolder = new TopicFolder(topic) {Name = topic.Name};
                        TreeNode subNode = new TreeNode(topicFolder.Name) {Tag = topicFolder};

                        parent.Nodes.Add(subNode);
                    }
                }
            }
        }
示例#3
0
        /// <summary>
        /// Display the page for the specified forum.
        /// </summary>
        public override bool ViewFromFolder(FolderBase folder, Address address, FolderOptions flags)
        {
            if (folder is TopicFolder)
            {
                _currentFolder = folder as TopicFolder;
                _thisForum = CIX.DirectoryCollection.ForumByName(_currentFolder.Name);

                FoldersTree.SetTopicName(folder.Name);

                CIX.DirectoryCollection.RefreshForum(folder.Name);

                FillCanvas();
            }
            return true;
        }