예제 #1
0
 public void ExecuteModerating(ICommandContext context, int?messageId)
 {
     using (var frm = new ModeratingForm(
                context,
                ForumCommandHelper.GetMessageId(context, messageId)))
         frm.ShowDialog(context.GetRequiredService <IUIShell>().GetMainWindowParent());
 }
예제 #2
0
        public void ExecuteOpenMessageInJBrowser(ICommandContext context, int?messageId)
        {
            var url = JanusProtocolDispatcher.FormatURI(
                JanusProtocolResourceType.Message,
                ForumCommandHelper.GetMessageId(context, messageId).ToString());

            context.OpenUrlInBrowser(url, UrlBehavior.InternalBrowser);
        }
예제 #3
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));
 }
예제 #4
0
 public CommandStatus QueryModeratingStatus(ICommandContext context, int?messageId)
 {
     return
         (QueryMessageCommandStatus(context, messageId)
          .DisabledIfNot(
              () =>
     {
         var id = ForumCommandHelper.GetMessageId(context, messageId);
         using (var mgr = context.CreateDBContext())
             return mgr.Moderatorials().Any(m => m.MessageID == id);
     }));
 }
예제 #5
0
 public void ExecuteRateMessage(ICommandContext context, int[] messageIds, MessageRates rate)
 {
     using (var rateForm = new RateForm(context, rate))
         if (rateForm.ShowDialog(
                 context
                 .GetRequiredService <IUIShell>()
                 .GetMainWindowParent()) == DialogResult.Yes)
         {
             ForumCommandHelper
             .GetMessageIds(context, messageIds)
             .ForEach(
                 msgId =>
                 context
                 .GetRequiredService <IOutboxManager>()
                 .RateMarks
                 .Add(msgId, rate));
         }
 }
예제 #6
0
        public void ExecuteGoToMessage(
            ICommandContext context, int?messageId)
        {
            var parentWindow = context
                               .GetRequiredService <IUIShell>()
                               .GetMainWindowParent();

            if (Config.Instance.ConfirmationConfig.ConfirmJump &&
                MessageBox.Show(
                    parentWindow,
                    SR.Search.JumpRequest,
                    SR.Search.Confirmation,
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }

            if (ApplicationManager.Instance.ForumNavigator.SelectMessage(
                    ForumCommandHelper.GetMessageId(context, messageId)))
            {
                var mainWindowSvc = context.GetService <IMainWindowService>();
                if (mainWindowSvc != null)
                {
                    mainWindowSvc.EnsureVisible();
                }
            }
            else
            {
                MessageBox.Show(
                    parentWindow,
                    SR.Search.NotFound,
                    SR.Search.Error,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
        }
예제 #7
0
 public IDisposable SubscribeMessageExportStatusChanged(
     IServiceProvider serviceProvider, Action handler)
 {
     return(ForumCommandHelper.SubscribeMessageCommandStatusChanged(serviceProvider, handler));
 }
예제 #8
0
 public CommandStatus QueryMessageExportStatus(ICommandContext context)
 {
     return(ForumCommandHelper.GetMultipleMessagesCommandStatus(context, null)
            .Or(QueryForumCommandStatus(context, null)));
 }
 public CommandStatus QueryMessageCommandStatus(ICommandContext context, int?messageId)
 {
     return(ForumCommandHelper.GetSingleMessageCommandStatus(context, messageId));
 }
 public void ExecuteWarnModeratorOnRsdn(ICommandContext context, int?messageId)
 {
     context.OpenUrlInBrowser(
         RsdnUrlHelper.GetWarnModeratorUrl(
             ForumCommandHelper.GetMessageId(context, messageId)));
 }
 public void ExecuteOpenModeratingOnRsdn(ICommandContext context, int?messageId)
 {
     context.OpenUrlInBrowser(
         RsdnUrlHelper.GetSelfModerateUrl(
             ForumCommandHelper.GetMessageId(context, messageId)));
 }
예제 #12
0
 public void ExecuteOpenMessageOnRsdn(ICommandContext context, int?messageId)
 {
     context.OpenUrlInBrowser(
         SiteUrlHelper.GetMessageUrl(
             ForumCommandHelper.GetMessageId(context, messageId)));
 }
예제 #13
0
 public CommandStatus QueryMessagesCommandStatus(ICommandContext context, int[] messageIds)
 {
     return(ForumCommandHelper.GetMultipleMessagesCommandStatus(context, messageIds));
 }
예제 #14
0
 public void ExecuteShowMessageRating(ICommandContext context, int?messageId)
 {
     context.OpenUrlInBrowser(
         SiteUrlHelper.GetRatingUrl(
             ForumCommandHelper.GetMessageId(context, messageId)));
 }