コード例 #1
0
ファイル: TopicView.cs プロジェクト: cixonline/cixreader
        /// <summary>
        /// Action the specified ID with the given message item.
        /// </summary>
        /// <param name="id">An action ID</param>
        /// <param name="message">A selected message, or null</param>
        private void Action(ActionID id, CIXMessage message)
        {
            switch (id)
            {
                case ActionID.Chat:
                    Chat(message);
                    break;

                case ActionID.Block:
                    if (message != null)
                    {
                        string titleString = string.Format(Resources.BlockTitle, message.Author);
                        string promptString = string.Format(Resources.BlockPrompt, message.Author);
                        if (MessageBox.Show(promptString, titleString, MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            CIX.RuleCollection.Block(message.Author);
                            OnMessageChanged(message);
                        }
                    }
                    break;

                case ActionID.Participants:
                    if (_currentFolder.ID > 0)
                    {
                        TopicFolder topic = (TopicFolder) _currentFolder;
                        Folder forum = topic.Folder.ParentFolder;
                        Participants parDialog = new Participants(FoldersTree.MainForm, forum.Name);
                        parDialog.ShowDialog();
                    }
                    break;

                case ActionID.ManageForum:
                    if (_currentFolder.ID > 0)
                    {
                        TopicFolder topicFolder = (TopicFolder) _currentFolder;
                        Folder forumFolder = topicFolder.Folder.ParentFolder;
                        DirForum forum = CIX.DirectoryCollection.ForumByName(forumFolder.Name);
                        FoldersTree.ManageForum(forum);
                    }
                    break;

                case ActionID.Email:
                    Email(message);
                    break;

                case ActionID.Profile:
                case ActionID.AuthorImage:
                    FoldersTree.MainForm.Address = string.Format("cixuser:{0}", message.Author);
                    break;

                case ActionID.Priority:
                    PriorityThread(message);
                    break;

                case ActionID.Ignore:
                    IgnoreThread(message);
                    break;

                case ActionID.ReadLock:
                    ToggleReadLock(message);
                    break;

                case ActionID.Quote:
                    if (message != null)
                    {
                        Comment(message, message.Body.Quoted());
                    }
                    break;

                case ActionID.Edit:
                case ActionID.Reply:
                    if (message != null)
                    {
                        if (message.Topic.Flags.HasFlag(FolderFlags.OwnerCommentsOnly) && !message.IsMine)
                        {
                            Action(ActionID.ReplyByMail);
                        }
                        else
                        {
                            Comment(message, null);
                        }
                    }
                    break;

                case ActionID.ReplyByMail:
                    {
                        InboxMessageEditor newMessageWnd = new InboxMessageEditor(message);
                        newMessageWnd.Show();
                    }
                    break;

                case ActionID.Print:
                    Print(message);
                    break;

                case ActionID.Read:
                    ToggleRead(message);
                    break;

                case ActionID.Star:
                    ToggleStar(message);
                    break;

                case ActionID.Withdraw:
                    WithdrawMessage(message);
                    break;

                case ActionID.Delete:
                    DeleteMessage(message);
                    break;

                case ActionID.NextUnread:
                    GoToNextUnread(message);
                    break;

                case ActionID.NextPriorityUnread:
                    GoToNextPriorityUnread(message);
                    break;

                case ActionID.GoToSource:
                    GoToSourceThread(message);
                    break;

                case ActionID.Link:
                    CopyLinkToClipboard(message);
                    break;

                case ActionID.PageMessage:
                    if (tsvMessagePane.Items.Count > 0)
                    {
                        MessageItem messageItem = tsvMessagePane.Items[0] as MessageItem;
                        if (messageItem != null)
                        {
                            if (ScrollMessageUp())
                            {
                                break;
                            }
                            if (messageItem.Message.Unread)
                            {
                                MarkAsRead(messageItem.Message);
                            }
                            FoldersTree.NextUnread(FolderOptions.NextUnread);

                            // Put focus back on thread
                            ActiveControl = tsvMessages;
                        }
                    }
                    break;

                case ActionID.GoTo:
                    if (CanAction(ActionID.GoTo))
                    {
                        GoToMessageDialog();
                    }
                    break;

                case ActionID.MarkThreadRead:
                    MarkThreadRead(message);
                    FoldersTree.NextUnread(FolderOptions.NextUnread);
                    break;

                case ActionID.MarkThreadReadThenRoot:
                    MarkThreadRead(message);
                    FoldersTree.NextUnread(FolderOptions.NextUnread | FolderOptions.Root);
                    break;

                case ActionID.MarkTopicRead:
                    MarkTopicRead();
                    FoldersTree.NextUnread(FolderOptions.NextUnread);
                    break;

                case ActionID.NextRoot:
                    SelectRoot(message, RootToSelect.NextRoot);
                    break;

                case ActionID.Root:
                    SelectRoot(message, RootToSelect.PreviousRoot);
                    break;

                case ActionID.Original:
                    SelectOriginal(message);
                    break;

                case ActionID.NewMessage:
                    NewMessage(string.Empty);
                    break;

                case ActionID.SelectAll:
                    SelectAll();
                    break;

                case ActionID.Expand:
                    ExpandCollapseThread(message);
                    break;

                case ActionID.Copy:
                    CopySelection();
                    break;
            }
        }
コード例 #2
0
ファイル: InboxView.cs プロジェクト: cixonline/cixreader
        /// <summary>
        /// Action the specified ID with the given conversation.
        /// </summary>
        /// <param name="id">An action ID</param>
        /// <param name="conversation">A selected conversation, or null</param>
        private void Action(ActionID id, InboxConversation conversation)
        {
            switch (id)
            {
                case ActionID.NewMessage:
                    FoldersTree.MainForm.Address = "cixmail:";
                    break;

                case ActionID.Print:
                    Print(conversation);
                    break;

                case ActionID.Profile:
                case ActionID.AuthorImage:
                    FoldersTree.MainForm.Address = string.Format("cixuser:{0}", conversation.Author);
                    break;

                case ActionID.Withdraw:
                    conversation.MarkDelete();
                    break;

                case ActionID.PageMessage:
                case ActionID.NextUnread:
                    GoToNextUnread(conversation);
                    break;

                case ActionID.NextPriorityUnread:
                    GoToNextPriorityUnread(conversation);
                    break;

                case ActionID.Edit:
                case ActionID.Reply:
                    {
                        InboxMessageEditor newMessageWnd = new InboxMessageEditor(conversation);
                        newMessageWnd.Show();
                        break;
                    }

                case ActionID.Read:
                    MarkConversationAsRead(conversation);
                    break;

                case ActionID.SelectAll:
                    SelectAll();
                    break;
            }
        }