EditMessage() public static method

public static EditMessage ( IServiceProvider provider, MessageFormMode mode, MessageInfo msgInfo ) : void
provider IServiceProvider
mode MessageFormMode
msgInfo MessageInfo
return void
示例#1
0
        public void Edit(object item)
        {
            MessageInfo info;
            var         id = ((NewMessage)item).ID;

            using (var db = _provider.CreateDBContext())
            {
                var msg = db.OutboxMessages(m => m.ID == id);
                info =
                    msg
                    .Select(
                        m =>
                        new MessageInfo(
                            m.ID,
                            m.ForumID,
                            m.ReplyToID,
                            m.Subject,
                            m.Body))
                    .Single();
                msg.Set(_ => _.Hold, _ => true).Update();
            }
            MessageEditor.EditMessage(
                _provider,
                MessageFormMode.Edit,
                info);
            _provider
            .GetRequiredService <IOutboxManager>()
            .NewMessages
            .Refresh();
        }
示例#2
0
 public void ExecuteWriteMessage(
     ICommandContext context, int?forumId)
 {
     MessageEditor.EditMessage(
         context,
         MessageFormMode.Add,
         new MessageInfo(GetForumId(context, forumId)));
 }
示例#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);
        }
示例#4
0
        public void AddBugReport(
            string bugName,
            string bugDescription,
            string stackTrace,
            bool showEditor)
        {
            var mi = new MessageInfo(_bugReportForumId, _bugReportTopicId,
                                     bugName, string.Format(
                                         SR.Outbox.BugReportTemplate,
                                         bugName, bugDescription,
                                         ApplicationInfo.NameWithVersion,
                                         Config.Instance.DbDriver,
                                         stackTrace));

            if (showEditor)
            {
                MessageEditor.EditMessage(_serviceProvider, MessageFormMode.Add, mi);
            }
            else
            {
                NewMessages.Add(mi);
            }
        }