Browse Source

Allow user to connect to database without using auto-discovery.

Changed the Add New Database Connection dialog so when a driver is selected the
data source control is shown. This allows the user to enter connection details,
such as the username and password, without having to use the auto-discover button.
pull/28/head
Matt Ward 13 years ago
parent
commit
11c36f38c5
  1. 29
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/ConnectionWizardWindow.xaml.cs
  2. 5
      src/AddIns/DisplayBindings/Data/ICSharpCode.Data.SQLServer/SQLServerDatabaseDriver.cs

29
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.Core.UI/Windows/ConnectionWizardWindow.xaml.cs

@ -31,6 +31,7 @@ namespace ICSharpCode.Data.Core.UI.Windows @@ -31,6 +31,7 @@ namespace ICSharpCode.Data.Core.UI.Windows
private IDatasource _selectedDatasource = null;
private IDatabase _selectedDatabase = null;
private bool _isLoading = false;
IDatasource defaultDataSource = null;
#endregion
@ -47,22 +48,34 @@ namespace ICSharpCode.Data.Core.UI.Windows @@ -47,22 +48,34 @@ namespace ICSharpCode.Data.Core.UI.Windows
get { return _selectedDatabaseDriver; }
set
{
if (_selectedDatabaseDriver != value) {
defaultDataSource = GetDefaultDatasource(value);
_selectedDatasource = defaultDataSource;
} else if (value == null) {
defaultDataSource = null;
_selectedDatasource = null;
}
_selectedDatabaseDriver = value;
OnPropertyChanged("SelectedDatabaseDriver");
OnPropertyChanged("SelectedDatasource");
}
}
public IDatasource SelectedDatasource
IDatasource GetDefaultDatasource(IDatabaseDriver driver)
{
if (driver != null) {
return driver.CreateNewIDatasource("");
}
return null;
}
public IDatasource SelectedDatasource {
get { return _selectedDatasource; }
set
{
set {
if (value != null)
btnConnect.IsEnabled = true;
else
btnConnect.IsEnabled = false;
_selectedDatasource = value;
else
_selectedDatasource = defaultDataSource;
OnPropertyChanged("SelectedDatasource");
}
}
@ -177,6 +190,8 @@ namespace ICSharpCode.Data.Core.UI.Windows @@ -177,6 +190,8 @@ namespace ICSharpCode.Data.Core.UI.Windows
private void btnConnect_Click(object sender, RoutedEventArgs e)
{
if (!_selectedDatabaseDriver.IDatasources.Contains(_selectedDatasource))
_selectedDatasource.Name = cboDatasources.Text;
PopulateDatabases();
}

5
src/AddIns/DisplayBindings/Data/ICSharpCode.Data.SQLServer/SQLServerDatabaseDriver.cs

@ -122,6 +122,11 @@ namespace ICSharpCode.Data.Core.DatabaseDrivers.SQLServer @@ -122,6 +122,11 @@ namespace ICSharpCode.Data.Core.DatabaseDrivers.SQLServer
#endregion
public SQLServerDatabaseDriver()
{
Datasources = new DatabaseObjectsCollection<SQLServerDatasource>(null);
}
public override string Name
{
get { return "MS SQL Server"; }

Loading…
Cancel
Save