本文整理汇总了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);
}
示例2: QueryEditStatus
public CommandStatus QueryEditStatus(ICommandContext context)
{
var activeTagLineSvc = context.GetService<ITagLineListFormService>();
return activeTagLineSvc != null
&& activeTagLineSvc.SelectedTagLines.Count() == 1
? CommandStatus.Normal
: CommandStatus.Unavailable;
}
示例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;
}
示例4: QueryCompactDbStatus
public CommandStatus QueryCompactDbStatus(ICommandContext context)
{
var janusDatabaseManager = context.GetService<IJanusDatabaseManager>();
return janusDatabaseManager != null
&& janusDatabaseManager.GetCurrentDriverName() == JetDriver.DriverName
? CommandStatus.Normal
: CommandStatus.Unavailable;
}
示例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;
}
示例6: QueryShowMainFormStatus
public CommandStatus QueryShowMainFormStatus(ICommandContext context)
{
return context.GetService<IMainWindowService>() != null
? CommandStatus.Normal
: CommandStatus.Unavailable;
}
示例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;
}
示例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)));
}
示例9: QueryStopStatus
public CommandStatus QueryStopStatus(ICommandContext context)
{
var svc = context.GetService<IBrowserFormService>();
return
svc != null
? (svc.CanStop
? CommandStatus.Normal
: CommandStatus.Disabled)
: CommandStatus.Unavailable;
}
示例10: QueryJBrowserCommandStatus
public CommandStatus QueryJBrowserCommandStatus(ICommandContext context)
{
return context.GetService<IBrowserFormService>() != null
? CommandStatus.Normal
: CommandStatus.Unavailable;
}
示例11: QueryEditorCommandStatus
public CommandStatus QueryEditorCommandStatus(ICommandContext context)
{
return
context.GetService<IMessageEditorService>() != null
? CommandStatus.Normal
: CommandStatus.Unavailable;
}
示例12: QueryConsoleCommandStatus
public CommandStatus QueryConsoleCommandStatus(ICommandContext context)
{
return context.GetService<IConsoleWindowService>() != null
? CommandStatus.Normal
: CommandStatus.Unavailable;
}
示例13: QueryAddStatus
public CommandStatus QueryAddStatus(ICommandContext context)
{
var activeTagLineSvc = context.GetService<ITagLineListFormService>();
return activeTagLineSvc != null ? CommandStatus.Normal : CommandStatus.Unavailable;
}
示例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);
}
示例15: QuerySetMessagesReadMarkByDateStatus
public CommandStatus QuerySetMessagesReadMarkByDateStatus(ICommandContext context)
{
return context.GetService<IMessageMarkService>() != null
? CommandStatus.Normal
: CommandStatus.Unavailable;
}