internal string GetPassword() { if (bGotPassword) { return _DataSourceReferencePassword; } using (DataSourcePassword dlg = new DataSourcePassword()) { DialogResult rc = dlg.ShowDialog(); bGotPassword = true; if (rc == DialogResult.OK) { _DataSourceReferencePassword = dlg.PassPhrase; } return _DataSourceReferencePassword; } }
/// <summary> /// Clean up any resources being used. /// </summary> string GetPassword() { if (_DataSourceReferencePassword != null) return _DataSourceReferencePassword; DataSourcePassword dlg = new DataSourcePassword(); if (dlg.ShowDialog() == DialogResult.OK) _DataSourceReferencePassword = dlg.PassPhrase; return _DataSourceReferencePassword; }
string GetPassword() { /*Se a variável utilizada para a senha do banco de dados for nula, retornará a mesma variável*/ if (_DataSourceReferencePassword != null) return _DataSourceReferencePassword; /*Instância de um novo tipo de objeto (Senha de banco de dados)*/ DataSourcePassword dlg = new DataSourcePassword(); /*Caso o Dialog do objeto receba OK, irá passar*/ if (dlg.ShowDialog() == DialogResult.OK) _DataSourceReferencePassword = dlg.PassPhrase; return _DataSourceReferencePassword; //retorno do método. }