本文整理汇总了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));
}
示例2: AddService
public void AddService(IService service) {
services.Add(service);
service.Initialize();
}
示例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;
}