本文整理汇总了C#中ServiceProvider类的典型用法代码示例。如果您正苦于以下问题:C# ServiceProvider类的具体用法?C# ServiceProvider怎么用?C# ServiceProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceProvider类属于命名空间,在下文中一共展示了ServiceProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public override void SetUp()
{
base.SetUp();
var serviceProvider = new ServiceProvider();
myWebScrapSC = serviceProvider.Browser();
}
示例2: ScriptSynthesizer
/// <summary>
/// Initializes a new instance of the ScriptSynthesizer class.
/// </summary>
/// <param name="serviceProvider">Service provider.</param>
/// <param name="commonConfig">Common config of script synthesizer.</param>
/// <param name="scriptFeatureImportConfig">Config of script feature import.</param>
/// <param name="customizedFeaturePluginManager">Plugin manager of customized feature extraction.</param>
public ScriptSynthesizer(ServiceProvider serviceProvider,
ScriptSynthesizerCommonConfig commonConfig,
ScriptFeatureImportConfig scriptFeatureImportConfig,
CustomizedFeaturePluginManager customizedFeaturePluginManager)
{
if (serviceProvider == null)
{
throw new ArgumentNullException("serviceProvider");
}
// commonConfig can be null.
// scriptFeatureImportConfig can be null.
// customizedFeaturePluginManager can be null.
_serviceProvider = serviceProvider;
_scriptFeatureImportConfig = scriptFeatureImportConfig;
if (commonConfig != null)
{
_logger = new TextLogger(commonConfig.TraceLogFile);
_logger.Reset();
}
if (_scriptFeatureImportConfig != null)
{
_scriptFeatureImport = new ScriptFeatureImport(commonConfig,
_scriptFeatureImportConfig, _serviceProvider, _logger);
}
if (customizedFeaturePluginManager != null)
{
_customizedFeatureExtraction = new CustomizedFeatureExtraction(_serviceProvider,
customizedFeaturePluginManager);
}
}
示例3: MixedVoiceSynthesizer
/// <summary>
/// Initializes a new instance of the MixedVoiceSynthesizer class.
/// </summary>
/// <param name="donator">Service provider the donator.</param>
/// <param name="receiver">Service provider the receiver.</param>
/// <param name="config">Config object.</param>
public MixedVoiceSynthesizer(ServiceProvider donator, ServiceProvider receiver,
MixedVoiceSynthesizerConfig config)
{
if (donator == null)
{
throw new ArgumentNullException("donator");
}
if (receiver == null)
{
throw new ArgumentNullException("receiver");
}
if (config == null)
{
throw new ArgumentNullException("config");
}
_donator = donator;
_receiver = receiver;
_config = config;
_donator.Engine.AcousticProsodyTagger.Processed +=
new EventHandler<TtsModuleEventArgs>(OnDonatorAcousticProcessed);
_receiver.Engine.AcousticProsodyTagger.Processed +=
new EventHandler<TtsModuleEventArgs>(OnReceiverAcousticProcessed);
if (!string.IsNullOrEmpty(config.LogFile))
{
_logger = new TextLogger(config.LogFile);
_logger.Reset();
}
}
示例4: ServiceProviders
public ServiceProvider[] ServiceProviders(string version)
{
ServiceProvider[] listServiceProviders = new ServiceProvider[1];
ServiceProvider nikotelServiceProvider = new ServiceProvider();
nikotelServiceProvider.Name = "nikotel - the voip network";
nikotelServiceProvider.Description = "Visit www.nikotel.com";
nikotelServiceProvider.IMServerAddress = "im.nikotel.com";
nikotelServiceProvider.IMServerPort = 5222;
nikotelServiceProvider.SIPProxyRealm = "nikotel.com";
nikotelServiceProvider.SIPProxyAddress = "voip.nikotel.com";
nikotelServiceProvider.SIPProxyPort = 5060;
nikotelServiceProvider.VideoProxyAddress = "video.nikotel.com";
nikotelServiceProvider.VideoProxyPort = 800;
nikotelServiceProvider.SignupLink = "https://www.nikotel.com/nikotel-signup/nikotalk/register";
listServiceProviders[0] = nikotelServiceProvider;
return listServiceProviders;
}
示例5: CreateCallSite
public IServiceCallSite CreateCallSite(ServiceProvider provider, ISet<Type> callSiteChain)
{
ConstructorInfo[] constructors = _descriptor.ImplementationType.GetTypeInfo()
.DeclaredConstructors
.Where(IsInjectable)
.ToArray();
// TODO: actual service-fulfillment constructor selection
if (constructors.Length == 1)
{
ParameterInfo[] parameters = constructors[0].GetParameters();
IServiceCallSite[] parameterCallSites = new IServiceCallSite[parameters.Length];
for (var index = 0; index != parameters.Length; ++index)
{
parameterCallSites[index] = provider.GetServiceCallSite(parameters[index].ParameterType, callSiteChain);
if (parameterCallSites[index] == null && parameters[index].HasDefaultValue)
{
parameterCallSites[index] = new ConstantCallSite(parameters[index].DefaultValue);
}
if (parameterCallSites[index] == null)
{
throw new InvalidOperationException(Resources.FormatCannotResolveService(
parameters[index].ParameterType,
_descriptor.ImplementationType));
}
}
return new ConstructorCallSite(constructors[0], parameterCallSites);
}
return new CreateInstanceCallSite(_descriptor);
}
示例6: allowAccessButton_Click
protected void allowAccessButton_Click(object sender, EventArgs e)
{
if (this.AuthorizationSecret != OAuthAuthorizationSecToken.Value) {
throw new ArgumentException(); // probably someone trying to hack in.
}
this.AuthorizationSecret = null; // clear one time use secret
var pending = Global.PendingOAuthAuthorization;
Global.AuthorizePendingRequestToken();
multiView.ActiveViewIndex = 1;
ServiceProvider sp = new ServiceProvider(Constants.SelfDescription, Global.TokenManager);
var response = sp.PrepareAuthorizationResponse(pending);
if (response != null) {
sp.Channel.Send(response);
} else {
if (pending.IsUnsafeRequest) {
verifierMultiView.ActiveViewIndex = 1;
} else {
string verifier = ServiceProvider.CreateVerificationCode(VerificationCodeFormat.AlphaNumericNoLookAlikes, 10);
verificationCodeLabel.Text = verifier;
ITokenContainingMessage requestTokenMessage = pending;
var requestToken = Global.TokenManager.GetRequestToken(requestTokenMessage.Token);
requestToken.VerificationCode = verifier;
Global.TokenManager.UpdateToken(requestToken);
}
}
}
示例7: TestServiceCreatorCallback
public void TestServiceCreatorCallback()
{
ServiceProvider provider = new ServiceProvider();
provider.Add<ILog>(new ServiceCreatorCallback<ILog>(ServiceRequested));
ILog log = provider.Get<ILog>();
Assert.IsNotNull(log);
}
示例8: PropertiesEditorLauncher
public PropertiesEditorLauncher(ServiceProvider serviceProvider)
{
if (serviceProvider == null)
throw new ArgumentNullException("serviceProvider");
this.serviceProvider = serviceProvider;
}
示例9: CustomizedFeatureExtraction
/// <summary>
/// Initializes a new instance of the CustomizedFeatureExtraction class.
/// </summary>
/// <param name="serviceProvider">Service provider.</param>
/// <param name="customizedFeaturePluginManager">Plugin manager.</param>
public CustomizedFeatureExtraction(ServiceProvider serviceProvider,
CustomizedFeaturePluginManager customizedFeaturePluginManager)
{
if (serviceProvider == null)
{
throw new ArgumentNullException("serviceProvider");
}
if (customizedFeaturePluginManager == null)
{
throw new ArgumentNullException("customizedFeaturePluginManager");
}
_customizedFeaturePluginManager = customizedFeaturePluginManager;
List<PluginInfo> pluginInfos = _customizedFeaturePluginManager.GetPlugins(
CustomizedFeaturePluginManager.AttachBeforeExtraction);
if (pluginInfos != null)
{
_utteranceExtenders = UtteranceExtenderFinder.LoadUtteranceExtenders(pluginInfos);
}
_serviceProvider = serviceProvider;
_serviceProvider.Engine.AcousticProsodyTagger.Processing += new EventHandler<TtsModuleEventArgs>(OnAcousticProcessing);
}
示例10: SignInPage
protected internal SignInPage(PhoneApplicationPage page)
: base(page)
{
SignIn = new SimpleActionCommand(_ => SelectServiceProvider.Execute(ClientData.VidyanoServiceProvider));
RetryConnect = new SimpleActionCommand(async _ =>
{
if (State == SignInPageState.NoInternet)
await Connect();
});
SelectServiceProvider = new SimpleActionCommand(provider =>
{
selectedProvider = (ServiceProvider)provider;
promptServiceProviderWaiter.Set();
});
Page.BackKeyPress += (_, e) =>
{
promptServiceProviderWaiter.Set();
if (oauthBrowserWaiter != null)
oauthBrowserWaiter.Set();
if (ClientData != null && !String.IsNullOrEmpty(ClientData.DefaultUserName))
e.Cancel = true;
};
}
示例11: TestAddDuplicateService2
public void TestAddDuplicateService2()
{
ServiceProvider provider = new ServiceProvider();
provider.Add<ILog>(new ServiceCreatorCallback<ILog>(ServiceRequested));
ILog log1 = new NoLog();
provider.Add<ILog>(log1);
}
示例12: GetAllResultsAsJSON
public string GetAllResultsAsJSON(ServiceProvider serviceProvider, string apiKey, string apiPwd)
{
if (serviceProvider == ServiceProvider.CoulombChargePoint)
{
//Coulomb notes: logdata.endTime field in Reference.cs autocreated as DateTime but needs to be serialized as string as value is often 24:00, change property type to string
OCM.Import.NetworkServices.ThirdPartyServices.Coulomb.coulombservicesClient svc = new Import.NetworkServices.ThirdPartyServices.Coulomb.coulombservicesClient();
svc.ClientCredentials.UserName.UserName = apiKey;
svc.ClientCredentials.UserName.Password = apiPwd;
string output = "";
OCM.Import.NetworkServices.ThirdPartyServices.Coulomb.logdata[] stationData = { new OCM.Import.NetworkServices.ThirdPartyServices.Coulomb.logdata() { } };
string result = svc.getAllUSStations(new OCM.Import.NetworkServices.ThirdPartyServices.Coulomb.stationSearchRequest()
{
// Geo = new Import.NetworkServices.ThirdPartyServices.Coulomb.stationSearchRequestGeo { lat = "38.5846", @long = "-121.4961" },
Country = "USA",
Proximity = 50000,
postalCode = "95816"
},
out output, out stationData);
JavaScriptSerializer js = new JavaScriptSerializer();
js.MaxJsonLength = 10000000;
string outputJS = js.Serialize(stationData);
System.Diagnostics.Debug.WriteLine("<json>"+outputJS+"</json>");
return outputJS;
}
return null;
}
示例13: Engine
static Engine()
{
Status = EngineStatus.Stopped;
// The service provider is always there so that
// it can be mocked during unit tests.
ServiceProvider = new ServiceProvider();
}
示例14: TestAddDuplicateService1
public void TestAddDuplicateService1()
{
ServiceProvider provider = new ServiceProvider();
ILog log1 = new NoLog();
ILog log2 = new NoLog();
provider.Add<ILog>(log1);
provider.Add<ILog>(log2);
}
示例15: Invoke
public object Invoke(ServiceProvider provider)
{
var array = Array.CreateInstance(_itemType, _serviceCallSites.Length);
for (var index = 0; index < _serviceCallSites.Length; index++)
{
array.SetValue(_serviceCallSites[index].Invoke(provider), index);
}
return array;
}