Ejemplo n.º 1
0
        public void ExecuteAddForumMessageToFavorites(
            ICommandContext context, int?messageId)
        {
            var manager   = context.GetRequiredService <IFavoritesManager>();
            var activeMsg = ForumMessageCommandHelper.GetMessage(context, messageId);

            using (var selForm =
                       new FavoritesSelectFolderForm(
                           context,
                           manager.RootFolder,
                           true))
            {
                selForm.Comment = activeMsg.Subject;

                var windowParent = context.GetRequiredService <IUIShell>().GetMainWindowParent();

                if (selForm.ShowDialog(windowParent) == DialogResult.OK)
                {
                    var folder = selForm.SelectedFolder ?? manager.RootFolder;
                    if (!manager.AddMessageLink(activeMsg.ID, selForm.Comment, folder))
                    {
                        //сообщения уже есть в разделе
                        MessageBox.Show(
                            windowParent,
                            SR.Favorites.ItemExists.FormatStr(
                                activeMsg.ID, folder.Name),
                            ApplicationInfo.ApplicationName,
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Information);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public CommandStatus QuerySetMessagesReadMarkStatus(
     ICommandContext context, int[] messageIds, bool isRead, bool markChilds)
 {
     return(QueryMessagesCommandStatus(context, messageIds).DisabledIfNot(
                () => ForumMessageCommandHelper.GetMessages(context, messageIds)
                .Any(msg => msg.CanSetMessageReadMark(isRead, markChilds))));
 }
Ejemplo n.º 3
0
 public CommandStatus QuerySetMessagesRepliesAutoReadMarkStatus(
     ICommandContext context, int[] messageIds, bool isEnabled)
 {
     return(QueryMessagesCommandStatus(context, messageIds).DisabledIfNot(
                () => ForumMessageCommandHelper
                .GetMessages(context, messageIds)
                .Any(msg => msg.ReadReplies != isEnabled)));
 }
Ejemplo n.º 4
0
 public void ExecuteSetMessagesRepliesAutoReadMark(
     ICommandContext context, int[] messageIds, bool isEnabled)
 {
     ForumHelper.SetMessageRepliesAutoReadMark(
         context,
         ForumMessageCommandHelper.GetMessages(context, messageIds).Cast <MsgBase>(),
         isEnabled);
 }
Ejemplo n.º 5
0
 public CommandStatus QuerySetTopicReadMarkStatus(
     ICommandContext context, int[] messageIds, bool isRead)
 {
     return(QueryMessagesCommandStatus(context, messageIds).DisabledIfNot(
                () => ForumMessageCommandHelper.GetMessages(context, messageIds)
                .Select(msg => msg.Topic)
                .Any(msg => msg.CanSetMessageReadMark(isRead, true))));
 }
Ejemplo n.º 6
0
 public CommandStatus QueryGoToMessageCommandStatus(
     ICommandContext context, int?messageId)
 {
     return(ForumCommandHelper.GetSingleMessageCommandStatus(context, messageId)
            .UnavailableIfNot(
                () => Forums.Instance.ActiveForum == null ||
                ForumMessageCommandHelper.GetMessage(context, messageId).ForumID !=
                Forums.Instance.ActiveForum.ID));
 }
Ejemplo n.º 7
0
 public void ExecuteRegetTopic(ICommandContext context, int[] messageIds)
 {
     foreach (var msg in ForumMessageCommandHelper.GetMessages(context, messageIds))
     {
         context
         .GetOutboxManager()
         .DownloadTopics
         .Add(
             SR.Forum.DownloadTopicRegetSource,
             msg.ID,
             msg.Subject);
     }
 }
Ejemplo n.º 8
0
        public void ExecuteSetMessageReadMark(
            ICommandContext context, int[] messageIds, bool isRead, bool markChilds)
        {
            if (Features.Instance.ActiveFeature is Forum)
            {
                ForumDummyForm.Instance.StopMarkTimer();
            }

            ForumHelper.MarkMsgRead(
                context,
                ForumMessageCommandHelper.GetMessages(context, messageIds).Cast <MsgBase>(),
                isRead,
                markChilds);
        }
Ejemplo n.º 9
0
        public void ExecuteReplyMessage(ICommandContext context, int?messageId)
        {
            var msg = ForumMessageCommandHelper.GetMessage(context, messageId);

            var messageInfo = new MessageInfo(
                msg.ForumID,
                msg.ID,
                msg.Subject,
                Format.Forum.GetEditMessage(
                    DatabaseManager.GetMessageBody(context, msg.ID),
                    msg.UserNick));

            MessageEditor.EditMessage(context, MessageFormMode.Reply, messageInfo);
        }
Ejemplo n.º 10
0
        public void ExecuteSetTopicReadMark(ICommandContext context, int[] messageIds, bool isRead)
        {
            if (Features.Instance.ActiveFeature is Forum)
            {
                ForumDummyForm.Instance.StopMarkTimer();
            }

            ForumHelper.MarkMsgRead(
                context,
                ForumMessageCommandHelper
                .GetMessages(context, messageIds)
                .Select(msg => msg.Topic)
                .Cast <MsgBase>(),
                isRead,
                true);
        }
Ejemplo n.º 11
0
        public void ExecuteCopyMessageAuthorAddress(ICommandContext context, int?messageId)
        {
            var msg = ForumMessageCommandHelper.GetMessage(context, messageId);

            ClipboardHelper.CopyUrl(SiteUrlHelper.GetUserProfileUrl(msg.UserID), msg.UserNick);
        }
Ejemplo n.º 12
0
        public void ExecuteCopyMessageAddress(ICommandContext context, int?messageId)
        {
            var msg = ForumMessageCommandHelper.GetMessage(context, messageId);

            ClipboardHelper.CopyUrl(SiteUrlHelper.GetMessageUrl(msg.ID), msg.Subject);
        }
Ejemplo n.º 13
0
 public CommandStatus QueryRateMessageStatus(ICommandContext context, int[] messageIds)
 {
     return(QueryMessagesCommandStatus(context, messageIds).DisabledIfNot(
                () => !ForumMessageCommandHelper.GetMessages(context, messageIds)
                .Any(msg => msg.UserID == Config.Instance.SelfId)));
 }
Ejemplo n.º 14
0
 public CommandStatus QueryReplyMessageStatus(ICommandContext context, int?messageId)
 {
     return(QueryMessageCommandStatus(context, messageId).DisabledIfNot(
                () => !ForumMessageCommandHelper.GetMessage(context, messageId).Closed));
 }