GetMessage() public static method

Возвращает сообщение с указанным идентификатором, либо если идентификатор не указан, возвращает текущее активное сообщение.
public static GetMessage ( IServiceProvider serviceProvider, int messageId ) : IForumMessageInfo
serviceProvider IServiceProvider
messageId int
return IForumMessageInfo
Example #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);
                    }
                }
            }
        }
Example #2
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));
 }
Example #3
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);
        }
Example #4
0
        public void ExecuteCopyMessageAuthorAddress(ICommandContext context, int?messageId)
        {
            var msg = ForumMessageCommandHelper.GetMessage(context, messageId);

            ClipboardHelper.CopyUrl(SiteUrlHelper.GetUserProfileUrl(msg.UserID), msg.UserNick);
        }
Example #5
0
        public void ExecuteCopyMessageAddress(ICommandContext context, int?messageId)
        {
            var msg = ForumMessageCommandHelper.GetMessage(context, messageId);

            ClipboardHelper.CopyUrl(SiteUrlHelper.GetMessageUrl(msg.ID), msg.Subject);
        }
Example #6
0
 public CommandStatus QueryReplyMessageStatus(ICommandContext context, int?messageId)
 {
     return(QueryMessageCommandStatus(context, messageId).DisabledIfNot(
                () => !ForumMessageCommandHelper.GetMessage(context, messageId).Closed));
 }