private void changeProviderPlace(string move) { ObservableCollection <Provider> tempProviders = new ObservableCollection <Provider>(); if (Providers.Contains(SelectedProvider)) { int actualIndex = Providers.IndexOf(SelectedProvider); if (move == "before") { Provider previousProvider = new Provider(); if (actualIndex != 0) { foreach (Provider p in Providers) { if (Providers.IndexOf(p) == actualIndex - 1) { previousProvider = p; } else if (Providers.IndexOf(p) == actualIndex) { tempProviders.Add(p); tempProviders.Add(previousProvider); } else { tempProviders.Add(p); } } Providers = tempProviders; refreshSettings(); } } if (move == "after") { Provider nextProvider = new Provider(); if (actualIndex != Providers.Count() - 1) { foreach (Provider p in Providers) { if (Providers.IndexOf(p) == actualIndex + 1) { nextProvider = p; } else if (Providers.IndexOf(p) == actualIndex) { nextProvider = Providers[Providers.IndexOf(p) + 1]; tempProviders.Add(nextProvider); tempProviders.Add(p); } else { tempProviders.Add(p); } } Providers = tempProviders; refreshSettings(); } } } }
public bool Remove(IProvider site) { if (!Providers.Contains(site)) { return(false); } Providers.Remove(site); return(true); }
protected override IEnumerable <string> GetProviders() { if (!TestBase.UserProviders.Contains(TestBase.DefaultProvider !)) { // initialize default database, even if we don't run tests against it // because it is used as source of test data yield return(TestBase.DefaultProvider !); } foreach (var provider in TestBase.UserProviders.Where(p => !Providers.Contains(p) && TestBase.Providers.Contains(p))) { yield return(provider); } }
public IOAuthSettings GetProvider(string name) { if (!Providers.Contains(name)) { throw new ArgumentException("Provider settings isn't defined"); } if (!OAuthSettings.ContainsKey(name)) { var oAuthSetting = new OAuthSettings(); Configuration.GetSection($"{SectionName}:{name}").Bind(oAuthSetting); OAuthSettings[name] = oAuthSetting; } return(OAuthSettings[name]); }
protected override IEnumerable <string> GetProviders() { return(TestBase.UserProviders.Where(p => !Providers.Contains(p) && TestBase.Providers.Contains(p))); }
private void validCorrespondence() { List <int> fieldsAssociation = new List <int>(); if (SelectedEanIndex > -1) { fieldsAssociation.Add(SelectedEanIndex); } else { fieldsAssociation.Add(-1); } if (SelectedPriceIndex > -1) { fieldsAssociation.Add(SelectedPriceIndex); } else { fieldsAssociation.Add(-1); } if (SelectedDescrIndex > -1) { fieldsAssociation.Add(SelectedDescrIndex); } else { fieldsAssociation.Add(-1); } if (SelectedCategIndex > -1) { fieldsAssociation.Add(SelectedCategIndex); } else { fieldsAssociation.Add(-1); } SelectedProvider.Correspondences = fieldsAssociation; if (!Providers.Contains(SelectedProvider)) { Providers.Add(SelectedProvider); } string settingsLine = SelectedProvider.Name + ';'; for (int i = 0; i < 4; i++) { if (i < 3) { settingsLine += SelectedProvider.Correspondences[i] + ","; } else { settingsLine += SelectedProvider.Correspondences[i]; } } settingsLine += ';'; settingsLine += SelectedProvider.File; SetSetting(SelectedProvider.Name, settingsLine); if (Providers.Contains(SelectedProvider)) { Provider p = SelectedProvider; Providers.Remove(SelectedProvider); Providers.Add(p); } ProviderName = ""; ProviderFile = ""; VisibilityCorrespondenceSelector = Hidden; VisibilityHome = Visible; }