本文整理汇总了C#中IServiceRegistry.GetService方法的典型用法代码示例。如果您正苦于以下问题:C# IServiceRegistry.GetService方法的具体用法?C# IServiceRegistry.GetService怎么用?C# IServiceRegistry.GetService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServiceRegistry
的用法示例。
在下文中一共展示了IServiceRegistry.GetService方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EffectInstallerBase
/// <summary>
/// Initializes a new instance of the <see cref="EffectInstallerBase"/> class.
/// </summary>
/// <param name="services">The services.</param>
/// <exception cref="System.ArgumentNullException">services</exception>
/// <exception cref="System.ArgumentException">Cannot locate IGraphicsDeviceService;services</exception>
protected EffectInstallerBase(IServiceRegistry services)
{
if (services == null)
{
throw new ArgumentNullException("services");
}
Services = services;
graphicsDeviceService = (IGraphicsDeviceService)services.GetService(typeof(IGraphicsDeviceService));
if (graphicsDeviceService == null)
{
throw new ArgumentException("Cannot locate IGraphicsDeviceService", "services");
}
}
示例2: EditText
/// <summary>
/// Create a new instance of <see cref="EditText"/>.
/// </summary>
/// <param name="services">The game services</param>
/// <exception cref="ArgumentNullException"><paramref name="services"/> is null</exception>
/// <exception cref="ArgumentException"><paramref name="services"/> does not contain an <see cref="IGame"/> service.</exception>
public EditText(IServiceRegistry services)
{
if (services == null)
throw new ArgumentNullException("services");
game = services.GetService(typeof(IGame)) as GameBase;
if(game == null)
throw new ArgumentException("Provided services need to contain a provider for the IGame interface.");
InitializeImpl();
CanBeHitByUser = true;
IsSelectionActive = false;
Padding = new Thickness(8,4,0,8,8,0);
DrawLayerNumber += 4; // ( 1: image, 2: selection, 3: Text, 4:Cursor)
CaretWidth = 1f;
CaretFrequency = 1f;
}