private void ConnectCommandHandler(object state) { NewConnectionWindow ncw = new NewConnectionWindow(System.Windows.Application.Current.MainWindow); if (ncw.ShowDialog() == true) { try { var host = ncw.Host; var port = ncw.Port; AddActivity("Attempting to connect to {0} : {1}", host, port); client.Connect(host, port, ncw.Username, ncw.Password, ncw.CreateNewUserCheckBox.IsChecked ?? false); } catch (Exception ex) { AddActivity(ex.Message); } } }
/// <summary> /// Promts the user to enter a new connection. /// </summary> public NullableResult <ConnectionInfo> Prompt(IEnumerable <DbServerPluginInfo> availablePlugins) { ArgumentChecks.AssertNotNull(availablePlugins, nameof(availablePlugins)); var newConnectionWindow = new NewConnectionWindow(); newConnectionWindow.SetAvailableDbServerPlugins(availablePlugins); if (newConnectionWindow.ShowDialog() == true) { var model = newConnectionWindow.Model; var newConnection = new ConnectionInfo( model.DbServerPlugin, model.Host, model.IntegratedSecurity, model.UserId, model.Password); return(new NullableResult <ConnectionInfo>(newConnection)); } return(new NullableResult <ConnectionInfo>(null)); }