private async void setButton_Click(object sender, EventArgs e) { Properties.Settings.Default.SqlDataSource = sourceTextBox.Text; _dataBaseSettings.Source = sourceTextBox.Text; Properties.Settings.Default.SqlUserID = idTextBox.Text; _dataBaseSettings.Id = idTextBox.Text; Properties.Settings.Default.SqlPassword = passwordTextBox.Text; _dataBaseSettings.Password = passwordTextBox.Text; Properties.Settings.Default.ConnectionString = $"Data Source={_dataBaseSettings.Source};Initial Catalog={_dataBaseSettings.DatabaseName};Persist Security Info=True;User ID={_dataBaseSettings.Id};Password={_dataBaseSettings.Password}"; _dataBaseSettings.ConnectionString = Properties.Settings.Default.ConnectionString; try { OnBusyEvent(new BusyEventArgs() { IsBusy = true }); UseWaitCursor = true; await _databaseService.CreateDatabase(); UseWaitCursor = false; OnBusyEvent(new BusyEventArgs() { IsBusy = false }); } catch (Exception exception) { OnBusyEvent(new BusyEventArgs() { IsBusy = false }); UseWaitCursor = false; MessageBox.Show(exception.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error); } Invoke((MethodInvoker) delegate { Close(); }); }