protected virtual void RefreshClickedThreaded(object state)
        {
            DatabaseConnectionSettings settings = state as DatabaseConnectionSettings;
            DatabaseConnectionContext  context  = new DatabaseConnectionContext(settings);
            IDbFactory         fac  = DbFactoryService.GetDbFactory(settings.ProviderIdentifier);
            FakeConnectionPool pool = null;

            try {
                pool = new FakeConnectionPool(fac, fac.ConnectionProvider, context);
                pool.Initialize();
                if (pool.HasErrors)
                {
                    MessageService.ShowError(pool.Error);
                    return;
                }

                ISchemaProvider          prov      = fac.CreateSchemaProvider(pool);
                DatabaseSchemaCollection databases = prov.GetDatabases();

                DispatchService.GuiDispatch(delegate() {
                    foreach (DatabaseSchema db in databases)
                    {
                        storeDatabases.AppendValues(db.Name);
                    }
                });
                isDatabaseListEmpty = databases.Count == 0;
            } catch {
            } finally {
                if (pool != null)
                {
                    pool.Close();
                }
            }

            if (isDatabaseListEmpty)
            {
                DispatchService.GuiDispatch(delegate() {
                    storeDatabases.AppendValues(AddinCatalog.GetString("No databases found!"));
                });
            }
            else
            {
                DispatchService.GuiDispatch(delegate() {
                    TreeIter iter;
                    if (storeDatabases.GetIterFirst(out iter))
                    {
                        comboDatabase.SetActiveIter(iter);
                    }
                });
            }
        }
        protected virtual void TestClickedThreaded(object state)
        {
            DatabaseConnectionSettings settings = state as DatabaseConnectionSettings;
            DatabaseConnectionContext  context  = new DatabaseConnectionContext(settings);
            IDbFactory fac = DbFactoryService.GetDbFactory(settings.ProviderIdentifier);

            bool   success = false;
            string error   = null;

            FakeConnectionPool  pool = null;
            IPooledDbConnection conn = null;

            try {
                pool    = new FakeConnectionPool(fac, fac.ConnectionProvider, context);
                success = pool.Initialize();
                error   = pool.Error;
            } catch (System.Data.DataException ex) {
                error   = ex.Message;
                success = false;
            } finally {
                if (conn != null)
                {
                    conn.Release();
                    conn.Dispose();
                }
                if (pool != null)
                {
                    pool.Close();
                }
            }

            DispatchService.GuiDispatch(delegate() {
                buttonTest.Sensitive = true;
                if (success)
                {
                    labelTest.Text = AddinCatalog.GetString("Test Succeeded.");
                }
                else
                {
                    labelTest.Text = AddinCatalog.GetString("Test Failed: {0}.", error);
                }
            });
        }