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


C# IService.Initialize方法代码示例

本文整理汇总了C#中IService.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# IService.Initialize方法的具体用法?C# IService.Initialize怎么用?C# IService.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IService的用法示例。


在下文中一共展示了IService.Initialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadService

        private void LoadService(IService service, IDictionary<string, object> data, string name)
        {
            if (!data.ContainsKey(name)) return;

            Dictionary<string, object> serviceData = data[name] as Dictionary<string, object>;

            service.MiningEngine = this;
            _services.Add(service);
            service.Initialize(serviceData);

            _priceHistories.Add(new ServiceHistory(service.ServiceName, _statWindow, _outlierPercentage, _iqrMultiplier));
        }
开发者ID:Fuzzbawls,项目名称:MinerControl-KBomba,代码行数:12,代码来源:MiningEngine.cs

示例2: AddService

 public void AddService(IService service) {
     services.Add(service);
     service.Initialize();
 }
开发者ID:Niller,项目名称:LastStand,代码行数:4,代码来源:RootContext.cs

示例3: TryAddService

        /// <summary>
        ///   Tries to add a service.
        /// </summary>
        /// <returns> True for success. </returns>
        /// <param name='service'> The added service. </param>
        /// <param name='servicePluginName'> The name of the service plugin. </param>
        /// <param name="serviceName"> The name of the service instance </param>
        /// <param name='parameter'> The parameters of this service. </param>
        public bool TryAddService(out IService service, string servicePluginName, string serviceName,
                                    IDictionary<string, object> parameter)
        {
            try
            {
                if (PluginFactory.TryFindPlugin(out service, servicePluginName))
                {
                    if (WriteResource())
                    {
                        if (Services.ContainsKey(serviceName))
                        {
                            Logger.LogError(String.Format("There already exists a service with the name {0}", serviceName));
                            service = null;

                            FinishWriteResource();
                            return false;
                        }

                        service.Initialize(_fallen8, parameter);
                        Services.Add(serviceName, service);

                        FinishWriteResource();
                        return true;
                    }

                    throw new CollisionException(this);
                }
            }
            catch (Exception e)
            {
                Logger.LogError(String.Format("Fallen-8 was not able to add the {0} service plugin. Message: {1}",
                                  servicePluginName, e.Message));

                FinishWriteResource();

                service = null;
                return false;
            }

            service = null;
            return false;
        }
开发者ID:bbqchickenrobot,项目名称:fallen-8,代码行数:50,代码来源:ServiceFactory.cs


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