private void PopulateDatabases()
        {
            SetException(null);

            Thread thread = new Thread(new ThreadStart(delegate()
            {
                if (SelectedDatabaseDriver != null)
                {
                    SetIsLoading(true);

                    try
                    {
                        SelectedDatabaseDriver.PopulateDatabases();
                    }
                    catch (Exception ex)
                    {
                        Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                        {
                            MessageBox.Show(this, ex.Message, this.Title, MessageBoxButton.OK, MessageBoxImage.Error);
                        }));
                    }

                    SetIsLoading(false);
                }
            }));

            thread.SetApartmentState(ApartmentState.STA);
            thread.IsBackground = true;
            thread.Start();
        }
 private void cboDatasources_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         if (SelectedDatabaseDriver != null)
         {
             SelectedDatasource = SelectedDatabaseDriver.AddNewDatasource(cboDatasources.Text);
         }
     }
 }
        private void PopulateDatasources()
        {
            Thread thread = new Thread(new ThreadStart(delegate()
            {
                if (SelectedDatabaseDriver != null)
                {
                    SetIsLoading(true);
                    SelectedDatabaseDriver.PopulateDatasources();
                    SetIsLoading(false);
                }
            }
                                                       ));

            thread.SetApartmentState(ApartmentState.STA);
            thread.IsBackground = true;
            thread.Start();
        }