Skip to content

Commit

Permalink
Disabled searching when updating/launching
Browse files Browse the repository at this point in the history
  • Loading branch information
TekkaGB committed Sep 22, 2022
1 parent 6b64e34 commit f45bcdd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
26 changes: 15 additions & 11 deletions Unverum/ModUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ public async static void CheckForUpdates(string path, MainWindow main)
updateCounter = 0;
if (!Directory.Exists(path))
{
main.GameBox.IsEnabled = false;
main.ModGrid.IsEnabled = false;
main.ConfigButton.IsEnabled = false;
main.LaunchButton.IsEnabled = false;
main.OpenModsButton.IsEnabled = false;
main.UpdateButton.IsEnabled = false;
main.EditLoadoutsButton.IsEnabled = false;
main.LoadoutsBox.IsEnabled = false;
main.LauncherOptionsBox.IsEnabled = false;
main.GameBox.IsEnabled = true;
main.ModGrid.IsEnabled = true;
main.ConfigButton.IsEnabled = true;
main.LaunchButton.IsEnabled = true;
main.OpenModsButton.IsEnabled = true;
main.UpdateButton.IsEnabled = true;
main.EditLoadoutsButton.IsEnabled = true;
main.LoadoutsBox.IsEnabled = true;
main.LauncherOptionsBox.IsEnabled = true;
main.ModGridSearchButton.IsEnabled = true;
main.Activate();
return;
}
Expand Down Expand Up @@ -99,9 +100,10 @@ public async static void CheckForUpdates(string path, MainWindow main)
main.ConfigButton.IsEnabled = true;
main.LaunchButton.IsEnabled = true;
main.OpenModsButton.IsEnabled = true;
main.UpdateButton.IsEnabled = true;
main.EditLoadoutsButton.IsEnabled = true;
main.LoadoutsBox.IsEnabled = true;
main.UpdateButton.IsEnabled = true;
main.ModGridSearchButton.IsEnabled = true;
if (!Global.config.CurrentGame.Equals("Dragon Ball FighterZ", StringComparison.InvariantCultureIgnoreCase))
main.LauncherOptionsBox.IsEnabled = true;
return;
Expand All @@ -127,9 +129,10 @@ public async static void CheckForUpdates(string path, MainWindow main)
main.ConfigButton.IsEnabled = true;
main.LaunchButton.IsEnabled = true;
main.OpenModsButton.IsEnabled = true;
main.UpdateButton.IsEnabled = true;
main.EditLoadoutsButton.IsEnabled = true;
main.LoadoutsBox.IsEnabled = true;
main.UpdateButton.IsEnabled = true;
main.ModGridSearchButton.IsEnabled = true;
if (!Global.config.CurrentGame.Equals("Dragon Ball FighterZ", StringComparison.InvariantCultureIgnoreCase))
main.LauncherOptionsBox.IsEnabled = true;
return;
Expand Down Expand Up @@ -168,6 +171,7 @@ public async static void CheckForUpdates(string path, MainWindow main)
main.UpdateButton.IsEnabled = true;
main.EditLoadoutsButton.IsEnabled = true;
main.LoadoutsBox.IsEnabled = true;
main.ModGridSearchButton.IsEnabled = true;
if (!Global.config.CurrentGame.Equals("Dragon Ball FighterZ", StringComparison.InvariantCultureIgnoreCase))
main.LauncherOptionsBox.IsEnabled = true;
main.Activate();
Expand Down
9 changes: 7 additions & 2 deletions Unverum/UI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public MainWindow()
EditLoadoutsButton.IsEnabled = false;
LoadoutsBox.IsEnabled = false;
LauncherOptionsBox.IsEnabled = false;
ModGridSearchButton.IsEnabled = false;
App.Current.Dispatcher.Invoke(() =>
{
ModUpdater.CheckForUpdates($"{Global.assemblyLocation}{Global.s}Mods{Global.s}{Global.config.CurrentGame}", this);
Expand Down Expand Up @@ -412,6 +413,7 @@ private async void Launch_Click(object sender, RoutedEventArgs e)
EditLoadoutsButton.IsEnabled = false;
LoadoutsBox.IsEnabled = false;
LauncherOptionsBox.IsEnabled = false;
ModGridSearchButton.IsEnabled = false;
Refresh();
Directory.CreateDirectory(Global.config.Configs[Global.config.CurrentGame].ModsFolder);
Global.logger.WriteLine($"Building loadout for {Global.config.CurrentGame}", LoggerType.Info);
Expand All @@ -426,6 +428,7 @@ private async void Launch_Click(object sender, RoutedEventArgs e)
GameBox.IsEnabled = true;
EditLoadoutsButton.IsEnabled = true;
LoadoutsBox.IsEnabled = true;
ModGridSearchButton.IsEnabled = true;
if (!Global.config.CurrentGame.Equals("Dragon Ball FighterZ", StringComparison.InvariantCultureIgnoreCase))
LauncherOptionsBox.IsEnabled = true;
return;
Expand All @@ -438,6 +441,7 @@ private async void Launch_Click(object sender, RoutedEventArgs e)
GameBox.IsEnabled = true;
EditLoadoutsButton.IsEnabled = true;
LoadoutsBox.IsEnabled = true;
ModGridSearchButton.IsEnabled = true;
if (!Global.config.CurrentGame.Equals("Dragon Ball FighterZ", StringComparison.InvariantCultureIgnoreCase))
LauncherOptionsBox.IsEnabled = true;
}
Expand Down Expand Up @@ -997,6 +1001,7 @@ private void Update_Click(object sender, RoutedEventArgs e)
EditLoadoutsButton.IsEnabled = false;
LoadoutsBox.IsEnabled = false;
LauncherOptionsBox.IsEnabled = false;
ModGridSearchButton.IsEnabled = false;
App.Current.Dispatcher.Invoke(() =>
{
ModUpdater.CheckForUpdates($"{Global.assemblyLocation}{Global.s}Mods{Global.s}{Global.config.CurrentGame}", this);
Expand Down Expand Up @@ -2170,7 +2175,7 @@ private void ModGrid_PreviewKeyDown(object sender, KeyEventArgs e)

private void Window_KeyDown(object sender, KeyEventArgs e)
{
if (IsLoaded && managerSelected)
if (IsLoaded && managerSelected && ModGridSearchButton.IsEnabled)
if (e.KeyboardDevice.IsKeyDown(Key.LeftCtrl) || e.KeyboardDevice.IsKeyDown(Key.RightCtrl))
{
switch (e.Key)
Expand All @@ -2189,7 +2194,7 @@ private void ModGrid_SearchBar_KeyDown(object sender, KeyEventArgs e)
}
private void ModGridSearch()
{
if (!String.IsNullOrEmpty(ModGrid_SearchBar.Text))
if (!String.IsNullOrEmpty(ModGrid_SearchBar.Text) && ModGridSearchButton.IsEnabled)
{
object focusedItem = null;
ModGrid.SelectedItems.Clear();
Expand Down

0 comments on commit f45bcdd

Please sign in to comment.