private bool ReLoadDatabases() { if (reloadingDatabases) { return(true); } dataBases = null; try { cboDatabase.Sensitive = false; btnOK.Sensitive = false; reloadingDatabases = true; cboDatabase.Load(new [] { Translator.GetString("Loading...") }, null, null, null); PresentationDomain.ProcessUIEvents(); string dbProviderName = DbProvider; if (!BusinessDomain.TryConnect(dbProviderName, Server, SlaveServer, User, Password)) { cboDatabase.Load(new [] { Translator.GetString("None", "Database") }, null, null, null); reloadingDatabases = false; return(false); } DataHelper.FireAndForget(startedProvider => { try { dataBases = BusinessDomain.GetDatabases(); // If the provider changed after we started to look for databases, don't show them if (startedProvider != DbProvider) { return; } PresentationDomain.Invoke(() => { bool hasDbs = dataBases.Length > 0; if (hasDbs) { cboDatabase.Load(dataBases, null, null, BusinessDomain.AppConfiguration.DbDatabase); } else { cboDatabase.Load(new [] { Translator.GetString("None", "Database") }, null, null, null); } cboDatabase.Sensitive = hasDbs; btnOK.Sensitive = hasDbs; reloadingDatabases = false; }); } catch { cboDatabase.Load(new [] { Translator.GetString("None", "Database") }, null, null, null); reloadingDatabases = false; } }, dbProviderName); return(true); } catch (Exception ex) { ErrorHandling.LogException(ex); return(false); } }