private void ButtonAdd_Click(object sender, RoutedEventArgs e) { var dialog = new ConnectionEditDialog(_providerFactory, _notificationView, this); if (dialog.ShowDialog() == true) { IConnection connection = _providerFactory.NewConnection(dialog.ServerName, dialog.DbName, dialog.Login, dialog.Password); _connectionRepository.Add(connection); ReloadConnections(); } }
private void ButtonEdit_Click(object sender, RoutedEventArgs e) { var oldConnection = listConnections.SelectedItem as ListItem; if (oldConnection != null) { var dialog = new ConnectionEditDialog(_providerFactory, _notificationView, this) { ServerName = oldConnection.Connection.ServerName, DbName = oldConnection.Connection.DbName, Login = oldConnection.Connection.Login, Password = oldConnection.Connection.Password }; if (dialog.ShowDialog() == true) { IConnection newConnection = _providerFactory.NewConnection(dialog.ServerName, dialog.DbName, dialog.Login, dialog.Password); _connectionRepository.Remove(oldConnection.Connection); _connectionRepository.Add(newConnection); ReloadConnections(); } } }