Skip to content

Commit

Permalink
Fix Install button being disabled after cancelling install
Browse files Browse the repository at this point in the history
  • Loading branch information
cooolbros committed May 5, 2023
1 parent 964225f commit 2eab19c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/TF2HUD.Editor/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ public async void BtnInstall_Click()
MainWindow.SetupDirectory(true);

// Stop the process if Team Fortress 2 is still running.
if (Utilities.CheckIsGameRunning()) return;
if (Utilities.CheckIsGameRunning())
{
Installing = false;
return;
}

// Clear tf/custom directory of other installed HUDs.
MainWindow.Logger.Info("Preparing directories for extraction.");
Expand All @@ -208,7 +212,11 @@ public async void BtnInstall_Click()
foreach (var foundHud in Directory.GetDirectories(MainWindow.HudPath))
{
if (!foundHud.Remove(0, MainWindow.HudPath.Length).ToLowerInvariant().Contains("hud") || !File.Exists($"{foundHud}\\info.vdf")) continue;
if (MainWindow.ShowMessageBox(MessageBoxImage.Warning, Resources.info_unsupported_hud_found, MessageBoxButton.YesNoCancel) != MessageBoxResult.Yes) return;
if (MainWindow.ShowMessageBox(MessageBoxImage.Warning, Resources.info_unsupported_hud_found, MessageBoxButton.YesNoCancel) != MessageBoxResult.Yes)
{
Installing = false;
return;
}
Directory.Delete(foundHud, true);
}

Expand Down Expand Up @@ -261,7 +269,11 @@ public async void BtnInstall_Click()
}

// Update the page view.
if (string.IsNullOrWhiteSpace(SelectedHud.Name)) return;
if (string.IsNullOrWhiteSpace(SelectedHud.Name))
{
Installing = false;
return;
}
SelectedHud.Settings.SaveSettings();
SelectedHud.ApplyCustomizations();

Expand Down

0 comments on commit 2eab19c

Please sign in to comment.