本文整理汇总了C#中ICommandHandler.CanHandleCommand方法的典型用法代码示例。如果您正苦于以下问题:C# ICommandHandler.CanHandleCommand方法的具体用法?C# ICommandHandler.CanHandleCommand怎么用?C# ICommandHandler.CanHandleCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICommandHandler
的用法示例。
在下文中一共展示了ICommandHandler.CanHandleCommand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CallCommandHandlerForEnabled
/// <summary>
/// protected virtual method that is called for each handler of a command to see whether that
/// command is enabled for the handler.
/// </summary>
/// <param name="handler">the handler that is being queried</param>
/// <param name="commandId">the command id that is being queried</param>
/// <returns>true if the command is enabled for this handler</returns>
protected virtual bool CallCommandHandlerForEnabled(ICommandHandler handler, string commandId)
{
return handler.CanHandleCommand(commandId);
}
示例2: CallCommandHandlerForEnabled
/// <summary>
/// protected overriden method that makes sure that we only run the "IsEnabled" call on the active
/// page component.
/// </summary>
/// <param name="handler">a handler the passed in command</param>
/// <param name="commandId">the command id</param>
/// <returns>true if this handler is the active component and it can handle the passed in commandid</returns>
protected override bool CallCommandHandlerForEnabled(ICommandHandler handler, string commandId)
{
// If this handler is not the active PageComponent, then the command is not enabled
// for this component because it does not have the focus
if (!_activeComponents.Contains(handler))
return false;
return handler.CanHandleCommand(commandId);
}