本文整理汇总了C#中System.Resolver.GetCommandByName方法的典型用法代码示例。如果您正苦于以下问题:C# Resolver.GetCommandByName方法的具体用法?C# Resolver.GetCommandByName怎么用?C# Resolver.GetCommandByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Resolver
的用法示例。
在下文中一共展示了Resolver.GetCommandByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PopulateCommands
/// <summary>
/// Populate the set of commands which this station supports. May be a zero-length list.
/// </summary>
/// <param name="configData">ConfigData for this station</param>
/// <param name="commandResolver"></param>
protected virtual void PopulateCommands(ConfigData configData, Resolver commandResolver)
{
var commandNames = configData.Values(Constants.StationCommand).ToList();
foreach (var name in commandNames)
{
if (commandResolver == null)
{
throw new Exception(string.Format("No CommandResolver available for command {0}, station {1}",
name, StationDescription));
}
var cmd = commandResolver.GetCommandByName(name);
if (cmd == null)
{
throw new Exception(string.Format("No Command found for commandName {0}, station {1}",
name, StationDescription));
}
Register(cmd);
}
}