Fixing error loading games

It was erroring when loading games into
a blank shortcut screen. This was stopping
us being able to select any games at all.
Fixed another problem with Shortcut.IsValid
causing exception when loading a profle
that no longer existed. It now will correctly
report that the shortcut is isvalid.
This commit is contained in:
Terry MacDonald 2021-03-05 11:12:27 +13:00
parent 634322ed05
commit 001e351106
4 changed files with 33 additions and 17 deletions

View File

@ -1935,9 +1935,13 @@ namespace DisplayMagician
// Does the profile we want to Use still exist?
// Is the profile still valid right now? i.e. are all the screens available?
if (ProfileToUse == null)
{
return (false,string.Format("The profile is not valid right now and cannot be used."));
}
if (!ProfileToUse.IsPossible)
{
return (false,string.Format("The profile '{0}' is not valid right now and cannot be used.",ProfileToUse.Name));
return (false, string.Format("The profile '{0}' is not valid right now and cannot be used.", ProfileToUse.Name));
}
// Is the main application still installed?
if (Category.Equals(ShortcutCategory.Application))

View File

@ -786,7 +786,7 @@ namespace DisplayMagician.UIForms
allGames.AddRange(UplayLibrary.AllInstalledGames);
// Load the Steam Games into the Games ListView
// Load all the Games into the Games ListView
foreach (var game in allGames.OrderBy(game => game.Name))
{
// Get the bitmap out of the IconPath
@ -805,10 +805,10 @@ namespace DisplayMagician.UIForms
// Add the images to the images array
il_games.Images.Add(bm);
if (!Visible)
/*if (!Visible)
{
return;
}
//return;
}*/
// ADd the game to the game array
lv_games.Items.Add(new ListViewItem
@ -930,18 +930,22 @@ namespace DisplayMagician.UIForms
// Set the launcher items if we have them
if (_shortcutToEdit.GameLibrary.Equals(SupportedGameLibrary.Unknown))
{
// Fill in the game library information to highliught there isn't one detected.
txt_game_launcher.Text = "None detected";
txt_game_name.Text = "No supported game libraries detected";
txt_args_game.Text = "";
if (allGames.Count <= 0)
{
// Fill in the game library information to highliught there isn't one detected.
txt_game_launcher.Text = "None detected";
txt_game_name.Text = "No supported game libraries detected";
txt_args_game.Text = "";
// Disable the Game library option, and select the Executable option instead.
p_game.Enabled = false;
p_game.Visible = false;
rb_wait_executable.Checked = true;
rb_launcher.Enabled = false;
rb_launcher.Visible = false;
lbl_no_game_libraries.Visible = true;
// Disable the Game library option, and select the Executable option instead.
p_game.Enabled = false;
p_game.Visible = false;
rb_wait_executable.Checked = true;
rb_launcher.Enabled = false;
rb_launcher.Visible = false;
lbl_no_game_libraries.Visible = true;
}
}
else

View File

@ -186,6 +186,9 @@ namespace DisplayMagician.UIForms
if (_selectedShortcut == null)
return;
if (!shortcutValidity[_selectedShortcut.Name])
return;
// Run the selected shortcut
btn_run.PerformClick();
}

View File

@ -151,6 +151,7 @@ namespace DisplayMagicianShared
//Doublecheck it's been added
if (ContainsProfile(profile))
{
IsPossibleRefresh();
return true;
}
else
@ -199,6 +200,7 @@ namespace DisplayMagicianShared
if (numRemoved == 1)
{
SaveProfiles();
IsPossibleRefresh();
return true;
}
else if (numRemoved == 0)
@ -248,6 +250,7 @@ namespace DisplayMagicianShared
if (numRemoved == 1)
{
SaveProfiles();
IsPossibleRefresh();
return true;
}
else if (numRemoved == 0)
@ -296,6 +299,7 @@ namespace DisplayMagicianShared
if (numRemoved == 1)
{
SaveProfiles();
IsPossibleRefresh();
return true;
}
else if (numRemoved == 0)
@ -449,7 +453,8 @@ namespace DisplayMagicianShared
SharedLogger.logger.Debug($"ProfileRepository/RenameProfile: The profile was not renamed from {profile.Name} to {renamedName}");
return false;
}
IsPossibleRefresh();
}