当前位置: 首页>>代码示例>>C#>>正文


C# ICommandContext.GetService方法代码示例

本文整理汇总了C#中ICommandContext.GetService方法的典型用法代码示例。如果您正苦于以下问题:C# ICommandContext.GetService方法的具体用法?C# ICommandContext.GetService怎么用?C# ICommandContext.GetService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICommandContext的用法示例。


在下文中一共展示了ICommandContext.GetService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExecuteGoToMessage

        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);
        }
开发者ID:permyakov,项目名称:janus,代码行数:31,代码来源:ForumViewerCommandTarget.cs

示例2: QueryEditStatus

		public CommandStatus QueryEditStatus(ICommandContext context)
		{
			var activeTagLineSvc = context.GetService<ITagLineListFormService>();
			return activeTagLineSvc != null
					&& activeTagLineSvc.SelectedTagLines.Count() == 1
				? CommandStatus.Normal
				: CommandStatus.Unavailable;
		}
开发者ID:rsdn,项目名称:janus,代码行数:8,代码来源:TagLineCommandTarget.cs

示例3: QuerySynchronizeStatus

        public CommandStatus QuerySynchronizeStatus(ICommandContext context)
        {
            var syncSvc = context.GetService<ISynchronizer>();

            if (syncSvc == null)
                return CommandStatus.Unavailable;

            return syncSvc.IsActive() ? CommandStatus.Disabled : CommandStatus.Normal;
        }
开发者ID:permyakov,项目名称:janus,代码行数:9,代码来源:SynchronizationCommandTarget.cs

示例4: QueryCompactDbStatus

		public CommandStatus QueryCompactDbStatus(ICommandContext context)
		{
			var janusDatabaseManager = context.GetService<IJanusDatabaseManager>();

			return janusDatabaseManager != null
				&& janusDatabaseManager.GetCurrentDriverName() == JetDriver.DriverName
				? CommandStatus.Normal
				: CommandStatus.Unavailable;
		}
开发者ID:rsdn,项目名称:janus,代码行数:9,代码来源:JetCommandTarget.cs

示例5: QueryForumCommandStatus

		public CommandStatus QueryForumCommandStatus(
			ICommandContext context, int? forumId)
		{
			if (forumId != null)
				return CommandStatus.Normal;

			var activeForumSvc = context.GetService<IActiveForumService>();
			return activeForumSvc?.ActiveForum != null
				? CommandStatus.Normal
				: CommandStatus.Unavailable;
		}
开发者ID:rsdn,项目名称:janus,代码行数:11,代码来源:ForumCommandTarget.cs

示例6: QueryShowMainFormStatus

		public CommandStatus QueryShowMainFormStatus(ICommandContext context)
		{
			return context.GetService<IMainWindowService>() != null 
				? CommandStatus.Normal
				: CommandStatus.Unavailable;
		}
开发者ID:rsdn,项目名称:janus,代码行数:6,代码来源:ApplicationCommandTarget.cs

示例7: QueryForumsCommandStatus

        private static CommandStatus QueryForumsCommandStatus(ICommandContext context, int[] forumIds)
        {
            if (forumIds != null)
                return CommandStatus.Normal;

            var activeForumSvc = context.GetService<IActiveForumService>();
            return activeForumSvc != null && activeForumSvc.ActiveForum != null
                ? CommandStatus.Normal
                : CommandStatus.Unavailable;
        }
开发者ID:permyakov,项目名称:janus,代码行数:10,代码来源:ForumCommandTarget.cs

示例8: QuerySetAllMessagesInForumReadMarkStatus

 public CommandStatus QuerySetAllMessagesInForumReadMarkStatus(
     ICommandContext context, int[] forumIds, bool isRead)
 {
     return QueryForumsCommandStatus(context, forumIds)
         .UnavailableIfNot(() => context.GetService<IMessageMarkService>() != null)
         .DisabledIfNot(
             () => GetForums(context, forumIds).Any(forum => forum.CanSetForumReadMark(isRead)));
 }
开发者ID:permyakov,项目名称:janus,代码行数:8,代码来源:ForumCommandTarget.cs

示例9: QueryStopStatus

 public CommandStatus QueryStopStatus(ICommandContext context)
 {
     var svc = context.GetService<IBrowserFormService>();
     return
         svc != null
             ? (svc.CanStop
                 ? CommandStatus.Normal
                 : CommandStatus.Disabled)
             : CommandStatus.Unavailable;
 }
开发者ID:permyakov,项目名称:janus,代码行数:10,代码来源:JBrowserCommandTarget.cs

示例10: QueryJBrowserCommandStatus

 public CommandStatus QueryJBrowserCommandStatus(ICommandContext context)
 {
     return context.GetService<IBrowserFormService>() != null
         ? CommandStatus.Normal
         : CommandStatus.Unavailable;
 }
开发者ID:permyakov,项目名称:janus,代码行数:6,代码来源:JBrowserCommandTarget.cs

示例11: QueryEditorCommandStatus

 public CommandStatus QueryEditorCommandStatus(ICommandContext context)
 {
     return
         context.GetService<IMessageEditorService>() != null
             ? CommandStatus.Normal
             : CommandStatus.Unavailable;
 }
开发者ID:permyakov,项目名称:janus,代码行数:7,代码来源:MessageEditorCommandTarget.cs

示例12: QueryConsoleCommandStatus

		public CommandStatus QueryConsoleCommandStatus(ICommandContext context)
		{
			return context.GetService<IConsoleWindowService>() != null
				? CommandStatus.Normal
				: CommandStatus.Unavailable;
		}
开发者ID:rsdn,项目名称:janus,代码行数:6,代码来源:ConsoleCommandTarget.cs

示例13: QueryAddStatus

		public CommandStatus QueryAddStatus(ICommandContext context)
		{
			var activeTagLineSvc = context.GetService<ITagLineListFormService>();
			return activeTagLineSvc != null ? CommandStatus.Normal : CommandStatus.Unavailable;
		}
开发者ID:rsdn,项目名称:janus,代码行数:5,代码来源:TagLineCommandTarget.cs

示例14: ExecuteGoToMessageWithPrompt

        public void ExecuteGoToMessageWithPrompt(ICommandContext context)
        {
            var parentWindow = context.GetRequiredService<IUIShell>().GetMainWindowParent();

            int mid;
            using (var etf = new EnterTopicMessageIdForm())
                if (etf.ShowDialog(parentWindow) == DialogResult.OK)
                    mid = etf.MessageId;
                else
                    return;

            if (ApplicationManager.Instance.ForumNavigator.SelectMessage(mid))
            {
                var mainWindowSvc = context.GetService<IMainWindowService>();
                if (mainWindowSvc != null)
                    mainWindowSvc.EnsureVisible();
            }
            else if (MessageBox.Show(
                parentWindow,
                SR.Forum.GoToMessage.NotFound.FormatStr(mid),
                SR.Search.Error,
                MessageBoxButtons.YesNo,
                MessageBoxIcon.Exclamation,
                MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                context
                    .GetRequiredService<IOutboxManager>()
                    .AddTopicForDownload(mid);
        }
开发者ID:permyakov,项目名称:janus,代码行数:28,代码来源:ForumViewerCommandTarget.cs

示例15: QuerySetMessagesReadMarkByDateStatus

 public CommandStatus QuerySetMessagesReadMarkByDateStatus(ICommandContext context)
 {
     return context.GetService<IMessageMarkService>() != null
         ? CommandStatus.Normal
         : CommandStatus.Unavailable;
 }
开发者ID:permyakov,项目名称:janus,代码行数:6,代码来源:ForumsCommandTarget.cs


注:本文中的ICommandContext.GetService方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。