Fully works with no game libraries

Now can handle when no game libraries
are detected. Need to make the game/application
UI nicer by adding groupboxes to it.
This commit is contained in:
Terry MacDonald 2021-01-07 11:51:02 +13:00
parent 8336e910b0
commit fef3fb34a7
2 changed files with 44 additions and 106 deletions

View File

@ -107,6 +107,14 @@ namespace DisplayMagician
if (String.IsNullOrWhiteSpace(_uuid)) if (String.IsNullOrWhiteSpace(_uuid))
_uuid = Guid.NewGuid().ToString("D"); _uuid = Guid.NewGuid().ToString("D");
// If there are no GameLibraries then choose executable instead
if (!(UplayLibrary.IsUplayInstalled && SteamLibrary.IsSteamInstalled))
{
_gameLibrary = SupportedGameLibrary.Unknown;
_gameName = "";
_gameArguments = "";
_category = ShortcutCategory.Application;
}
// Autocreate a name for the shortcut if AutoName is on // Autocreate a name for the shortcut if AutoName is on
// (and if we have a profile to use) // (and if we have a profile to use)
if (AutoName && _profileToUse is ProfileItem) if (AutoName && _profileToUse is ProfileItem)

View File

@ -71,91 +71,6 @@ namespace DisplayMagician.UIForms
}*/ }*/
} }
/* public string ProcessNameToMonitor
{
get
{
if (rb_switch_display_temp.Checked && rb_standalone.Checked) {
if (rb_wait_executable.Checked)
{
return txt_alternative_executable.Text;
}
}
return string.Empty;
}
set
{
// We we're setting this entry, then we want to set it to a particular entry
txt_alternative_executable.Text = value;
//rb_wait_executable.Checked = true;
}
}
*/
/* public string ExecutableNameAndPath
{
get => rb_switch_display_temp.Checked && rb_launcher.Checked ? txt_executable.Text : string.Empty;
set
{
if (File.Exists(txt_executable.Text))
{
rb_switch_display_temp.Checked = true;
rb_launcher.Checked = true;
txt_executable.Text = value;
}
}
}
*/
/* public uint ExecutableTimeout
{
get
{
if (rb_wait_executable.Checked)
{
return (uint)nud_timeout_executable.Value;
}
return 0;
}
set
{
nud_timeout_executable.Value = value;
}
}
public string ExecutableArguments
{
get => cb_args_executable.Checked ? txt_args_executable.Text : string.Empty;
set
{
txt_args_executable.Text = value;
cb_args_executable.Checked = true;
}
}
public uint GameAppId
{
get => rb_switch_display_temp.Checked && rb_launcher.Checked ? _gameId : 0;
set
{
rb_switch_display_temp.Checked = true;
rb_launcher.Checked = true;
_gameId = value;
}
}
public string GameName
{
get => rb_switch_display_temp.Checked && rb_launcher.Checked ? txt_game_name.Text : string.Empty;
set
{
rb_switch_display_temp.Checked = true;
rb_launcher.Checked = true;
txt_game_name.Text = value;
}
}
*/
public ShortcutItem Shortcut public ShortcutItem Shortcut
{ {
get => _shortcutToEdit; get => _shortcutToEdit;
@ -166,7 +81,7 @@ namespace DisplayMagician.UIForms
{ {
get get
{ {
if (rb_switch_display_temp.Checked && rb_launcher.Checked) if (rb_launcher.Checked)
{ {
if (txt_game_launcher.Text.Contains("Steam")) if (txt_game_launcher.Text.Contains("Steam"))
{ {
@ -182,8 +97,6 @@ namespace DisplayMagician.UIForms
} }
set set
{ {
rb_switch_display_temp.Checked = true;
rb_launcher.Checked = true;
switch (value) switch (value)
{ {
case SupportedGameLibrary.Steam: case SupportedGameLibrary.Steam:
@ -194,8 +107,11 @@ namespace DisplayMagician.UIForms
txt_game_launcher.Text = Enum.GetName(typeof(SupportedGameLibrary), SupportedGameLibrary.Uplay); txt_game_launcher.Text = Enum.GetName(typeof(SupportedGameLibrary), SupportedGameLibrary.Uplay);
break; break;
case SupportedGameLibrary.Unknown:
txt_game_launcher.Text = "No supported Game Libraries found";
break;
} }
// TODO - If SupportedGameLibrary.Unknown; then we need to show an error message.
} }
} }
@ -1088,28 +1004,42 @@ namespace DisplayMagician.UIForms
} }
// Set the launcher items if we have them // Set the launcher items if we have them
txt_game_launcher.Text = _shortcutToEdit.GameLibrary.ToString(); if (_shortcutToEdit.GameLibrary.Equals(SupportedGameLibrary.Unknown))
txt_game_name.Text = _shortcutToEdit.GameName;
_gameId = _shortcutToEdit.GameAppId;
nud_timeout_game.Value = _shortcutToEdit.StartTimeout;
txt_args_game.Text = _shortcutToEdit.GameArguments;
if (_shortcutToEdit.GameArgumentsRequired)
{ {
cb_args_game.Checked = true; // 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.
rb_wait_executable.Checked = true;
rb_launcher.Enabled = false;
}
else
{
txt_game_launcher.Text = _shortcutToEdit.GameLibrary.ToString();
txt_game_name.Text = _shortcutToEdit.GameName;
_gameId = _shortcutToEdit.GameAppId;
nud_timeout_game.Value = _shortcutToEdit.StartTimeout;
txt_args_game.Text = _shortcutToEdit.GameArguments;
if (_shortcutToEdit.GameArgumentsRequired)
{
cb_args_game.Checked = true;
}
//select the loaded Game item if it is there
foreach (ListViewItem gameItem in lv_games.Items)
{
if (gameItem.Text.Equals(_shortcutToEdit.GameName))
{
gameItem.Selected = true;
break;
}
}
} }
cb_autosuggest.Checked = _shortcutToEdit.AutoName; cb_autosuggest.Checked = _shortcutToEdit.AutoName;
//select the loaded Game item if it is there
foreach (ListViewItem gameItem in lv_games.Items)
{
if (gameItem.Text.Equals(_shortcutToEdit.GameName))
{
gameItem.Selected = true;
break;
}
}
// Set the executable items if we have them // Set the executable items if we have them
txt_executable.Text = _shortcutToEdit.ExecutableNameAndPath; txt_executable.Text = _shortcutToEdit.ExecutableNameAndPath;
nud_timeout_executable.Value = _shortcutToEdit.StartTimeout; nud_timeout_executable.Value = _shortcutToEdit.StartTimeout;