Skip to content

Commit

Permalink
Remove flicks when manually refresh database list
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Syrovatchenko committed May 31, 2020
1 parent 4d7958d commit 17021a5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
17 changes: 6 additions & 11 deletions Forms/DatabaseBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ private void ScanDatabases(object sender, DoWorkEventArgs e) {
try {
connection.Open();

if (!Settings.ServerInfo.IsAzure && Settings.ServerInfo.IsSysAdmin) {
_disks = QueryEngine.GetDiskInfo(connection);
}

_disks = QueryEngine.GetDiskInfo(connection);
_databases = QueryEngine.GetDatabases(connection);
}
catch (Exception ex) {
Expand All @@ -77,9 +74,11 @@ private void ScanDatabases(object sender, DoWorkEventArgs e) {
}

private void ScanDatabasesFinish(object sender, RunWorkerCompletedEventArgs e) {
if (_disks.Count > 0) {
Text = $"{Resources.DatabaseBoxTitle} {string.Join(" | ", _disks.Select(_ => _.ToString()))}";
}
Text = _disks.Count > 0
? $"{Resources.DatabaseBoxTitle} {string.Join(" | ", _disks.Select(_ => _.ToString()))}"
: Resources.DatabaseBoxTitle;

grid.DataSource = null;

if (_databases.Count > 0) {
var max = _databases.Max(_ => _.TotalSize);
Expand All @@ -106,10 +105,6 @@ private void RefreshDatabases() {
Output.Current.Add("Refresh databases...");

_ts = Stopwatch.StartNew();
_databases.Clear();
_disks.Clear();

grid.DataSource = null;
buttonOK.Enabled = false;
buttonRefresh.Enabled = false;
TotalSize.Visible = DataSize.Visible = LogSize.Visible = DataFreeSize.Visible = LogFreeSize.Visible = !Settings.ServerInfo.IsAzure;
Expand Down
2 changes: 1 addition & 1 deletion Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
<value>ModifyDate</value>
</data>
<data name="DatabaseBoxTitle" xml:space="preserve">
<value>Select Databases</value>
<value>Databases</value>
</data>
<data name="LastRead" xml:space="preserve">
<value>LastRead</value>
Expand Down

0 comments on commit 17021a5

Please sign in to comment.