public string GetPasswordForLogin(ProviderConfigurationItem providerConfigurationItem, string userName)
 {
     RegistryKey companyKey = Registry.CurrentUser.OpenOrCreateCompanyKey();
     RegistryKey geoPatKey = companyKey.OpenOrCreateKey("GeoPat");
     RegistryKey configKey = geoPatKey.OpenOrCreateKey("Configuration");
     RegistryKey providersKey = configKey.OpenOrCreateKey("Providers");
     String providerKeyName = providerConfigurationItem.GetHash();
     RegistryKey keyProvider = providersKey.OpenOrCreateKey(providerKeyName);
     if (keyProvider.GetValueNames().Contains(userName))
     {return keyProvider.GetValue(userName).ToString();}
     return "";
 }
 private void AddProviderItemExecute()
 {
     Window window = DialogService.CreateDialog("ProviderConfigurationCreateRegion", "Ajout d'une base decimal données");
     Nullable<Boolean> result = window.ShowDialog();
     if (result.HasValue && result.Value == true)
     {
         ProviderConfigurationCreateViewModel vm = window.FindChildDataContext<ProviderConfigurationCreateViewModel>();
         if (vm != null)
         {
             ProviderConfigurationItem item = new ProviderConfigurationItem();
             item.DisplayName = vm.DisplayName;
             item.IsDefault = false;
             item.ProviderFactoryTypeFullName = vm.SelectedProviderConfigurationType.ProviderType.FullName;
             item.Parameters.AddRange(vm.ProviderParameters);
             this.DataService.ProviderConfiguration.Items.Add(item);
             this.DataService.ProviderConfiguration.Save();
             this.LoadConfiguration();
         }
     }
 }
 private void RemoveProviderItemExecute(ProviderConfigurationItem item)
 {
     this.DataService.ProviderConfiguration.Items.Remove(item);
     this.DataService.ProviderConfiguration.Save();
     this.LoadConfiguration();
 }
        public void Load()
        {
            this.Items.Clear();
            RegistryKey companyKey = Registry.LocalMachine.OpenOrCreateCompanyKey();
            RegistryKey geoPatKey = companyKey.OpenOrCreateKey("GeoPat");
            RegistryKey configKey = geoPatKey.OpenOrCreateKey("Configuration");
            RegistryKey providersKey = configKey.OpenOrCreateKey("Providers");
            String[] providersKeyNames = providersKey.GetSubKeyNames();
            foreach (String providerKeyName in providersKeyNames)
            {
                RegistryKey providerKey = providersKey.OpenOrCreateKey(providerKeyName);
                ProviderConfigurationItem item = new ProviderConfigurationItem();
                item.DisplayName = providerKey.GetValue("DisplayName").ToString();
                item.IsDefault = providerKey.GetValue("IsDefault").ToString().ToUpper ().Equals ("TRUE");
                item.ProviderFactoryTypeFullName = providerKey.GetValue("ProviderFactoryTypeFulleName").ToString();
                RegistryKey parametersKey = providerKey.OpenOrCreateKey("Parameters");
                String[] parametersKeyNames = parametersKey.GetSubKeyNames();
                foreach (String parametersKeyName in parametersKeyNames)
                {
                    RegistryKey parameterKey = parametersKey.OpenOrCreateKey(parametersKeyName);
                    ProviderParameter parameter = new ProviderParameter("",parameterKey.GetValue("Code").ToString(), parameterKey.GetValue("Value").ToString());
                    item.Parameters.Add(parameter);

                }
                this.Items.Add(item);
            }
        }
 public void SetLoginPassword(ProviderConfigurationItem providerConfigurationItem, string login, string passord)
 {
     RegistryKey companyKey = Registry.CurrentUser.OpenOrCreateCompanyKey();
     RegistryKey geoPatKey = companyKey.OpenOrCreateKey("GeoPat");
     RegistryKey configKey = geoPatKey.OpenOrCreateKey("Configuration");
     RegistryKey providersKey = configKey.OpenOrCreateKey("Providers");
     String providerKeyName = providerConfigurationItem.GetHash();
     RegistryKey keyProvider = providersKey.OpenOrCreateKey(providerKeyName);
     keyProvider.SetValue(login, passord);
 }