private void AddNewProviderRegistration <T>(T provider) { Type providerType = provider.GetType(); if (providerType == typeof(IDataProvider)) { if (DataProvider != null) { throw new DataProviderAlreadySet(); } DataProvider = (IDataProvider)provider; Logger.Info($"Set Data Provider To {providerType.Name}."); return; } if (providerType == typeof(IAuthenticationProvider)) { if (AuthenticationProvider != null) { throw new AuthenticationProviderAlreadySet(); } AuthenticationProvider = (IAuthenticationProvider)provider; Logger.Info($"Set Authentication Provider To {providerType.Name}."); return; } if (Providers.ContainsKey(providerType)) { throw new ProviderWithTypeAlreadyRegistered(); } Providers.Add(providerType, (IProvider)provider); Logger.Info($"Registered Provider: {providerType.Name}."); }
public string RegisterProvider(List <string> arguments) { var toreturn = string.Empty; try { if (arguments[0] == "Solar") { Provider provider = new SolarProvider(arguments[1], double.Parse(arguments[2])); Providers.Add(provider); toreturn = $"Successfully registered Solar Provider - {arguments[1]}"; } else { Provider provider = new PressureProvider(arguments[1], double.Parse(arguments[2])); Providers.Add(provider); toreturn = $"Successfully registered Pressure Provider - {arguments[1]}"; } } catch (Exception e) { toreturn = e.Message; } return(toreturn); }
public Settings() { // // To add event handlers for saving and changing settings, uncomment the lines below: // // this.SettingChanging += this.SettingChangingEventHandler; // // this.SettingsSaving += this.SettingsSavingEventHandler; // // http://stackoverflow.com/a/13807361 // add the custom settings provider to all of the properties SettingsProvider provider = new CustomSettingsProvider(); // Try to re-use an existing provider, since we cannot have multiple providers // with same name. if (Providers[provider.Name] == null) { Providers.Add(provider); } else { provider = Providers[provider.Name]; } // Change default provider. foreach (SettingsProperty property in Properties) { if (property.PropertyType.GetCustomAttributes(typeof(SettingsProviderAttribute), false).Length == 0) { property.Provider = provider; } } }
public void LoadValuesFromConfigurationXml(XmlNode node) { if (node.Attributes["defaultProvider"] != null) { DefaultProvider = node.Attributes["defaultProvider"].Value; } foreach (XmlNode child in node.ChildNodes) { if (child.Name == "providers") { foreach (XmlNode providerNode in child.ChildNodes) { if ( providerNode.NodeType == XmlNodeType.Element && providerNode.Name == "add" ) { if ( providerNode.Attributes["name"] != null && providerNode.Attributes["type"] != null ) { ProviderSettings providerSettings = new ProviderSettings( providerNode.Attributes["name"].Value, providerNode.Attributes["type"].Value ); Providers.Add(providerSettings); } } } } } }
private async void Start() { var x = PressButton; MessageResult = ""; if (PressButton == PROVEEDOR) { var list = await providerService.GetProviderName(SearchName); Providers.Clear(); HasCoincidence = (list.Count > 0) ? true : false; foreach (var item in list) { Providers.Add(new Provider() { Code = item.Code, Name = item.Name }); } } else { var _list = new List <OrderTShirt>(); _list.Add(new OrderTShirt() { Code = SearchName }); SearchOrder(_list); } }
public override void AddNewProvider(DateTimeMaskFormatElementEditable editableFormat) { if (!ShowTime() && IsTimeProvider(editableFormat)) { return; } IItemsProvider provider = CreateNewFarsiProvider(editableFormat); if (provider != null) { if (ShouldInsertProvider(provider)) { Providers.Insert(firstTimeProviderIndex, provider); } else { Providers.Add(provider); } if (IsTimeProvider(editableFormat)) { if (firstTimeProviderIndex == -1) { firstTimeProviderIndex = Providers.Count - 1; } IsTimeProviderAdded = true; } TotalProviders += 1; } }
//Provider public Provider AssignProvider(Provider provider) { if (null == provider) { throw new ArgumentException("No Provider!"); } provider.PersonId = Id; var personProvider = Providers .FirstOrDefault( x => x.Source.IsSameAs(provider.Source) && x.SourceRef.IsSameAs(provider.SourceRef) && x.SourceSys.IsSameAs(provider.SourceSys)); if (null != personProvider) { Providers.Remove(personProvider); personProvider.ChangeTo(provider); Providers.Add(personProvider); return(personProvider); } Providers.Add(provider); return(provider); }
public Settings() { SettingsProvider provider = new crdx.Settings.PersistentSettingsProvider(); // Try to re-use an existing provider, since we cannot have multiple providers // with same name. if (Providers[provider.Name] == null) { Providers.Add(provider); } else { provider = Providers[provider.Name]; } // Change default provider. foreach (SettingsProperty property in Properties) { if ( property.PropertyType.GetCustomAttributes( typeof(SettingsProviderAttribute), false ).Length == 0 ) { property.Provider = provider; } } // // To add event handlers for saving and changing settings, uncomment the lines below: // // this.SettingChanging += this.SettingChangingEventHandler; // // this.SettingsSaving += this.SettingsSavingEventHandler; // }
public override bool CanAssist(RichCommandLineContext context) { Providers.Clear(); Providers.AddRange(standardProviders); CommandLineArgument targetArgument = null; if (context.PreviousNonWhitespaceToken != null && ArgParser.IsDashSpecifiedArgumentIdentifier(context.PreviousNonWhitespaceToken.Value)) { var candidate = context.PreviousNonWhitespaceToken.Value.Substring(1); targetArgument = (from a in Definition.AllGlobalAndActionArguments where a.IsMatch(candidate) select a).SingleOrDefault(); } if (targetArgument != null) { foreach (var assistant in targetArgument.Metadata.Metas <ArgContextualAssistant>()) { var dynamicProvider = assistant.GetContextAssistProvider(Definition); Providers.Add(dynamicProvider); } } foreach (var provider in Providers) { if (provider is PowerArgsContextAwareAssistant) { (provider as PowerArgsContextAwareAssistant).TargetArgument = targetArgument; } } var ret = base.CanAssist(context); return(ret); }
public Providers GetAllChildStockExchangeProvidersOf(ProductionOrderOperation operation) { Ids productionOrderBomIds = _dbTransactionData.ProductionOrderBomGetAll() .GetProductionOrderBomsBy(operation); Providers providers = new Providers(); foreach (var productionOrderBomId in productionOrderBomIds) { Demand productionOrderBom = _dbTransactionData.ProductionOrderBomGetById(productionOrderBomId); foreach (var stockExchangeProvider in GetAllChildProvidersOf(productionOrderBom)) { if (stockExchangeProvider.GetType() == typeof(StockExchangeProvider)) { providers.Add((StockExchangeProvider)stockExchangeProvider); } else { throw new MrpRunException( "A child of an productionOrderBom can only a StockExchangeProvider."); } } } if (providers.Any() == false) { return(null); } return(providers); }
public Settings() : base() { provider = new CustomSettingsProvider(); Providers.Clear(); Providers.Add(provider); }
static OEmbed() { // YouTube Providers.Add(new OEmbedProvider { Name = "YouTube", Schemes = new[] { @"https?://www\.youtube\.com/watch\?v=.+", @"https?://youtu\.be/.+" }, Endpoint = "http://www.youtube.com/oembed" }); // Flickr Providers.Add(new OEmbedProvider { Name = "Flickr", Schemes = new[] { @"https?://.+\.flickr\.com/photos/.+", @"https?://flic\.kr/p/.+" }, Endpoint = "http://www.flickr.com/services/oembed" }); // SlideShare Providers.Add(new OEmbedProvider { Name = "SlideShare", Schemes = new[] { @"https?://www\.slideshare\.net/.+/.+" }, Endpoint = "http://www.slideshare.net/api/oembed/2" }); // Hatena Blog Providers.Add(new OEmbedProvider { Name = "Hatena Blog", Schemes = new[] { @"http://.+\.hatenablog\.com/.+", @"http://.+\.hatenablog\.jp/.+", @"http://.+\.hateblo\.jp/.+", @"http://.+\.hatenadialy\.com/.+", @"http://.+\.hatenadialy\.jp/.+" }, Endpoint = "http://hatenablog.com/oembed" }); }
public Settings() { SettingsProvider provider = CreateAnArbitraryProviderHere(); // Try to re-use an existing provider, since we cannot have multiple providers // with same name. if (Providers[provider.Name] == null) { Providers.Add(provider); } else { provider = Providers[provider.Name]; } // Change default provider. foreach (SettingsProperty property in Properties) { if ( property.PropertyType.GetCustomAttributes( typeof(SettingsProviderAttribute), false ).Length == 0 ) { property.Provider = provider; } } }
private void testButton() { Provider f = new Provider(); f.Name = "TEST"; Providers.Add(f); }
public void Add(IFileSystemProvider fss) { Providers.Add(fss); foreach (var fs in fss.GetFileSystems()) { FileSystems.Add(fs); } }
public void AddProvider(ITimeProvider provider, bool canFail = true, bool isRandomized = true) { Providers.Add(new Entry { IsRandomized = isRandomized, Provider = provider }); }
public void OnAppearing() { Providers.Clear(); foreach (Provider provider in Provider.SelectAll()) { Providers.Add(provider); } }
/// <summary> /// Добавляет нового поставщика ОСП. /// </summary> /// <param name="newProvider">Новый поставщик ОСП</param> public void AddNewOspProvider(ProviderDTO newProvider) { if (newProvider != null) { Providers.Add(newProvider); //OspProvidersUpdated?.Invoke(); } }
private void LoadProviders() { var providersList = ServiceManager.Instance.ProviderService.GetProviderListFullInfo(); providersList.Sort((a, b) => String.Compare(a.Label, b.Label, StringComparison.Ordinal)); string un, domain; int port; VATRPCall.ParseSipAddress(_contactSipUsername, out un, out domain, out port); ProviderViewModel selectedProvider = null; foreach (var s in providersList) { if (s.Label == "_nologo") { continue; } var providerModel = new ProviderViewModel(s); Providers.Add(providerModel); if (s.Address == domain && domain.NotBlank()) { selectedProvider = providerModel; } if (App.CurrentAccount != null && s.Address == App.CurrentAccount.ProxyHostname) { _currentProvider = providerModel; } } var nlp = ServiceManager.Instance.ProviderService.FindProviderLooseSearch("_nologo"); if (nlp != null) { _nologoProvider = new ProviderViewModel(nlp); } if (selectedProvider == null) { if (_currentProvider == null) { _currentProvider = _nologoProvider; } _contactInitialSipHost = string.Empty; } if (_isAddMode) { SelectedProvider = selectedProvider ?? _currentProvider; } else { if (selectedProvider == null) { _contactInitialSipHost = domain; } SelectedProvider = selectedProvider ?? _nologoProvider; } }
public bool Add(IProvider site) { if (Providers.ToList().Contains(site)) { return(false); } Providers.Add(site); return(true); }
// CREA UN NUEVO PROVEEDOR Y LO AGREGA A LA LISTA DE PROVEEDORES public Provider AddNewProvider(int dni, string name, int cellphone, string adress) { Provider NewProvider = new Provider(); NewProvider.DNI = dni; NewProvider.Name = name; NewProvider.Cellphone = cellphone; NewProvider.Adress = adress; Providers.Add(NewProvider); return(NewProvider); }
public void AddProvider(IProvider provider) { if (provider.Id > 100) { Console.WriteLine($"ProviderManager::AddProvider Error. Provider Id must be smaller than 100. You are trying to add provider with Id = {provider.Id}"); return; } Providers.Add(provider); LoadSettings(provider); this.framework.EventServer.OnProviderAdded(provider); }
public IPluginProvider ActivateProvider(ProviderItem item) { if (Providers == null) { Providers = new List <IPluginProvider>(); } var provider = Activator.CreateInstance(item.Type, item.Parameters) as IPluginProvider; Providers.Add(provider); return(provider); }
public AddTraceWizardData(ConfigurationElement config, TraceFailedRequestsItem existing) { Editing = existing != null; if (existing == null) { FileName = "*"; } else { FileName = existing.Path; Codes = existing.Codes; Time = existing.TimeTaken.GetTotalSeconds(); Verbosity = existing.Verbosity; } var collection = config.GetCollection(); foreach (ConfigurationElement item in collection) { var name = item.GetAttribute("name").Value.ToString(); var areas = item.ChildElements["areas"].GetCollection(); var provider = new Provider { Name = name, Areas = new List <string>(areas.Count) }; foreach (ConfigurationElement area in areas) { provider.Areas.Add(area["name"].ToString()); } Providers.Add(provider); } if (existing != null) { var selection = existing.Element.GetCollection("traceAreas"); foreach (ConfigurationElement item in selection) { var name = item["provider"].ToString(); var areas = item["areas"].ToString(); foreach (var provider in Providers) { if (provider.Name == name) { provider.Selected = true; foreach (var area in areas.Split(',')) { provider.SelectedAreas.Add(area); } } } } } }
public void AddProfile(CollectionProfile profile) { foreach (var provider in profile.EventSpecs) { Providers.Add(provider); } foreach (var logger in profile.LoggerSpecs) { Loggers.Add(logger); } }
/// <summary> /// 转换字符串 /// </summary> /// <param name="input">输入</param> /// <returns>输出</returns> public static string Parse(this string input) { if (Providers.ContainsKey(CurrentUICulture.Name)) { return(Providers[CurrentUICulture.Name].Parse(input)); } var provider = new XmlLocalizationProvider(CurrentUICulture); Providers.Add(CurrentUICulture.Name, provider); return(provider.Parse(input)); }
/// <summary> /// Resets the provider collection. This needs to be called when providers change after /// first being set. /// </summary> private void ResetProviders() { Providers.Clear(); foreach (SettingsProperty sp in Properties) { if (Providers[sp.Provider.Name] == null) { Providers.Add(sp.Provider); } } }
internal static void PopulateDefaultProviders() { //Default provider for twitter Providers.Add(new Provider() { WrapperName = Provider.Wrapper.TwitterWrapper, ConsumerKey = "E3hm7J9IQbWLijpiQG7W8Q", ConsumerSecret = "SGKNuXyybt0iDdgsuzVbFHOaemV7V6pr0wKwbaT2MH0" }); //Default provider for facebook Providers.Add(new Provider() { WrapperName = Provider.Wrapper.FacebookWrapper, ConsumerKey = "152190004803645", ConsumerSecret = "64c94bd02180b0ade85889b44b2ba7c4" }); //Default provider for google Providers.Add(new Provider() { WrapperName = Provider.Wrapper.GoogleWrapper, ConsumerKey = "opensource.brickred.com", ConsumerSecret = "YC06FqhmCLWvtBg/O4W/aJfj" }); //Default provider for yahoo Providers.Add(new Provider() { WrapperName = Provider.Wrapper.YahooWrapper, ConsumerKey = "dj0yJmk9VTdaSUVTU3RrWlRzJmQ9WVdrOWNtSjZNMFpITm1VbWNHbzlNQS0tJnM9Y29uc3VtZXJzZWNyZXQmeD1iMA--", ConsumerSecret = "1db3d0b897dac60e151aa9e2499fcb2a6b474546" }); //Default provider for MSN Providers.Add(new Provider() { WrapperName = Provider.Wrapper.MSNWrapper, ConsumerKey = "000000004403D60E", ConsumerSecret = "cYqlii67pTvgPD4pdB7NUVC7L4MIHCcs" }); //Default provider for Linkedin Providers.Add(new Provider() { WrapperName = Provider.Wrapper.LinkedInWrapper, ConsumerKey = "9-mmqg28fpMocVuAg87exH-RXKs70yms52GSFIqkZN25S3m96kdPGBbuSxdSBIyL", ConsumerSecret = "e6NBqhDYE1fX17RwYGW5vMp25Cvh7Sbw9t-zMYTIW_T5LytY5OwJ12snh_YftgE4" }); //Default provider for MySpace Providers.Add(new Provider() { WrapperName = Provider.Wrapper.MySpaceWrapper, ConsumerKey = "29db395f5ee8426bb90b1db65c91c956", ConsumerSecret = "0fdccc829c474e42867e16b68cda37a4c4b7b08eda574fe6a959943e3e9be709" }); }
private async Task LoadProviderLookupAsync() { Providers.Clear(); Providers.Add(new NullLookupItem { DisplayMember = " - " }); var lookup = await _providerLookupDataService.GetProviderLookupAsync(); foreach (var lookupItem in lookup) { Providers.Add(lookupItem); } }
/// <summary> /// Registers a new provider of the specified <paramref name="providerType"/>. /// </summary> /// <param name="providerType">Type of the provider.</param> public void RegisterProvider(Type providerType) { if (IsProvider(providerType)) { foreach (var attr in providerType.GetCustomAttributes(typeof(SqlProviderAttribute), false).Cast <SqlProviderAttribute>()) { if (!Providers.ContainsKey(attr.ProviderInvariantName)) { Providers.Add(attr.ProviderInvariantName, providerType); } } } }