public static void CreateUser( IServiceProvider provider, string dbPath, string userName, string pwd) { if (!Directory.Exists(dbPath)) Directory.CreateDirectory(dbPath); var key = Registry.CurrentUser.CreateSubKey(_keyPath); if (key == null) throw new ApplicationException("Could not create registry key"); using(key) key.SetValue(_keyName, dbPath); Config.Instance.Login = userName; Config.Instance.EncodedPassword = pwd.EncryptPassword(); //При изменении критических данных сохраняем сразу Config.Save(); _instance = null; }