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


C# IServiceRegistry.GetService方法代码示例

本文整理汇总了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");
            }
        }
开发者ID:nikolaiklimov,项目名称:SharpDX,代码行数:21,代码来源:EffectInstallerBase.cs

示例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;
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:24,代码来源:EditText.cs


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