예제 #1
0
        private void ScanDatabases(object sender, DoWorkEventArgs e)
        {
            using (SqlConnection connection = Connection.Create(Settings.ActiveHost)) {
                try {
                    connection.Open();

                    try { _disks = QueryEngine.GetDiskInfo(connection); }
                    catch (Exception ex) { Utils.ShowErrorFrom(ex, "Refresh disk info failed"); }

                    try { _databases = QueryEngine.GetDatabases(connection); }
                    catch (Exception ex) { Utils.ShowErrorFrom(ex, "Refresh databases failed"); }

                    if (_databases.Count > 0 && !Settings.ServerInfo.IsAzure)
                    {
                        try { QueryEngine.RefreshDatabaseSize(connection, _databases); }
                        catch (Exception ex) { Utils.ShowErrorFrom(ex, "Refresh database sizes failed"); }
                    }
                }
                catch (Exception ex) {
                    Utils.ShowErrorFrom(ex, "Refresh failed");
                }
                finally {
                    connection.Close();
                }
            }
        }