Disable main window while getting DLCs

This commit is contained in:
Jeddunk 2020-12-23 19:18:11 +01:00
parent bf7f309ea6
commit c7308cfc29

View File

@ -126,12 +126,13 @@ namespace auto_creamapi
if (appId > 0) if (appId > 0)
{ {
var app = new SteamApp() {AppId = appId, Name = Game.Text}; var app = new SteamApp() {AppId = appId, Name = Game.Text};
var task = _cacheModel.GetListOfDlc(app, var steamDbIsChecked = SteamDb.IsChecked != null && (bool) SteamDb.IsChecked;
SteamDb.IsChecked != null && (bool) SteamDb.IsChecked); var task = _cacheModel.GetListOfDlc(app, steamDbIsChecked);
MainWindowGrid.IsEnabled = false;
var listOfDlc = await task; var listOfDlc = await task;
var result = "";
if (task.IsCompletedSuccessfully) if (task.IsCompletedSuccessfully)
{ {
var result = "";
listOfDlc.Sort((app1, app2) => app1.AppId.CompareTo(app2.AppId)); listOfDlc.Sort((app1, app2) => app1.AppId.CompareTo(app2.AppId));
listOfDlc.ForEach(x => result += $"{x.AppId}={x.Name}\n"); listOfDlc.ForEach(x => result += $"{x.AppId}={x.Name}\n");
ListOfDlcs.Text = result; ListOfDlcs.Text = result;
@ -141,6 +142,7 @@ namespace auto_creamapi
{ {
Status.Text = $"Could not get DLC for AppID {appId}"; Status.Text = $"Could not get DLC for AppID {appId}";
} }
MainWindowGrid.IsEnabled = true;
} }
else else
{ {