mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Fixed game refresh
This commit is contained in:
parent
6724a4d2ae
commit
2b653999dd
@ -35,6 +35,8 @@ namespace DisplayMagician.GameLibraries
|
||||
public static List<Game> AllInstalledGamesInAllLibraries { get; set; }
|
||||
public static bool GamesLoaded { get; set; } = false;
|
||||
|
||||
public static bool GamesImagesLoaded { get; set; } = false;
|
||||
|
||||
public virtual List<Game> AllInstalledGames { get; set; }
|
||||
|
||||
public virtual int InstalledGameCount { get; set; }
|
||||
@ -260,6 +262,12 @@ namespace DisplayMagician.GameLibraries
|
||||
}
|
||||
}
|
||||
|
||||
// Clear the game libraries in case this is a refresh
|
||||
SteamLibrary.GetLibrary().AllInstalledGames.Clear();
|
||||
UplayLibrary.GetLibrary().AllInstalledGames.Clear();
|
||||
OriginLibrary.GetLibrary().AllInstalledGames.Clear();
|
||||
EpicLibrary.GetLibrary().AllInstalledGames.Clear();
|
||||
GogLibrary.GetLibrary().AllInstalledGames.Clear();
|
||||
// Produce a single array of Games we can reference later
|
||||
GameLibrary.AllInstalledGamesInAllLibraries = SteamLibrary.GetLibrary().AllInstalledGames;
|
||||
GameLibrary.AllInstalledGamesInAllLibraries.AddRange(UplayLibrary.GetLibrary().AllInstalledGames);
|
||||
@ -344,6 +352,7 @@ namespace DisplayMagician.GameLibraries
|
||||
game.AvailableGameBitmaps = bmList;
|
||||
game.GameBitmap = ImageUtils.GetMeLargestAvailableBitmap(bmList);
|
||||
}
|
||||
GamesImagesLoaded = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,8 +26,8 @@ using System.Resources;
|
||||
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
|
||||
|
||||
// Version information
|
||||
[assembly: AssemblyVersion("2.1.0.202")]
|
||||
[assembly: AssemblyFileVersion("2.1.0.202")]
|
||||
[assembly: AssemblyVersion("2.1.0.214")]
|
||||
[assembly: AssemblyFileVersion("2.1.0.214")]
|
||||
[assembly: NeutralResourcesLanguageAttribute( "en" )]
|
||||
[assembly: CLSCompliant(true)]
|
||||
|
||||
|
21
DisplayMagician/UIForms/ShortcutForm.Designer.cs
generated
21
DisplayMagician/UIForms/ShortcutForm.Designer.cs
generated
@ -132,6 +132,7 @@ namespace DisplayMagician.UIForms
|
||||
this.cb_autosuggest = new System.Windows.Forms.CheckBox();
|
||||
this.btn_hotkey = new System.Windows.Forms.Button();
|
||||
this.lbl_hotkey_assigned = new System.Windows.Forms.Label();
|
||||
this.btn_refresh_games_list = new System.Windows.Forms.Button();
|
||||
this.tabc_shortcut.SuspendLayout();
|
||||
this.tabp_display.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbLogo)).BeginInit();
|
||||
@ -326,7 +327,7 @@ namespace DisplayMagician.UIForms
|
||||
this.tabp_audio.Location = new System.Drawing.Point(4, 32);
|
||||
this.tabp_audio.Name = "tabp_audio";
|
||||
this.tabp_audio.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabp_audio.Size = new System.Drawing.Size(1082, 713);
|
||||
this.tabp_audio.Size = new System.Drawing.Size(1082, 731);
|
||||
this.tabp_audio.TabIndex = 4;
|
||||
this.tabp_audio.Text = "2. Choose Audio";
|
||||
//
|
||||
@ -973,6 +974,7 @@ namespace DisplayMagician.UIForms
|
||||
//
|
||||
// p_game
|
||||
//
|
||||
this.p_game.Controls.Add(this.btn_refresh_games_list);
|
||||
this.p_game.Controls.Add(this.btn_choose_game_icon);
|
||||
this.p_game.Controls.Add(this.pb_game_icon);
|
||||
this.p_game.Controls.Add(this.lbl_no_game_libraries);
|
||||
@ -1489,6 +1491,22 @@ namespace DisplayMagician.UIForms
|
||||
this.lbl_hotkey_assigned.Visible = false;
|
||||
this.lbl_hotkey_assigned.Click += new System.EventHandler(this.lbl_hotkey_assigned_Click);
|
||||
//
|
||||
// btn_refresh_games_list
|
||||
//
|
||||
this.btn_refresh_games_list.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_refresh_games_list.FlatAppearance.MouseDownBackColor = System.Drawing.Color.IndianRed;
|
||||
this.btn_refresh_games_list.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Brown;
|
||||
this.btn_refresh_games_list.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.btn_refresh_games_list.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btn_refresh_games_list.ForeColor = System.Drawing.Color.White;
|
||||
this.btn_refresh_games_list.Location = new System.Drawing.Point(950, 162);
|
||||
this.btn_refresh_games_list.Name = "btn_refresh_games_list";
|
||||
this.btn_refresh_games_list.Size = new System.Drawing.Size(117, 25);
|
||||
this.btn_refresh_games_list.TabIndex = 42;
|
||||
this.btn_refresh_games_list.Text = "Refresh Games List";
|
||||
this.btn_refresh_games_list.UseVisualStyleBackColor = true;
|
||||
this.btn_refresh_games_list.Click += new System.EventHandler(this.btn_refresh_games_list_Click);
|
||||
//
|
||||
// ShortcutForm
|
||||
//
|
||||
this.AcceptButton = this.btn_save;
|
||||
@ -1658,5 +1676,6 @@ namespace DisplayMagician.UIForms
|
||||
private System.Windows.Forms.CheckBox cb_run_cmd_afterwards;
|
||||
private System.Windows.Forms.TextBox txt_run_cmd_afterwards_args;
|
||||
private System.Windows.Forms.CheckBox cb_run_cmd_afterwards_args;
|
||||
private System.Windows.Forms.Button btn_refresh_games_list;
|
||||
}
|
||||
}
|
@ -110,7 +110,11 @@ namespace DisplayMagician.UIForms
|
||||
|
||||
try
|
||||
{
|
||||
audioController = new CoreAudioController();
|
||||
if (audioController == null)
|
||||
{
|
||||
audioController = new CoreAudioController();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -775,7 +779,7 @@ namespace DisplayMagician.UIForms
|
||||
|
||||
// Save everything is golden and close the form.
|
||||
DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
private void txt_alternative_executable_TextChanged(object sender, EventArgs e)
|
||||
@ -941,9 +945,12 @@ namespace DisplayMagician.UIForms
|
||||
Game shortcutGame = null;
|
||||
|
||||
|
||||
// Parse the game bitmaps now as we need them
|
||||
GameLibraries.GameLibrary.RefreshGameBitmaps();
|
||||
|
||||
// Parse the game bitmaps now the first time as we need them
|
||||
// We need to add a refresh button to the shortcut page now!
|
||||
if (!GameLibraries.GameLibrary.GamesImagesLoaded)
|
||||
{
|
||||
GameLibraries.GameLibrary.RefreshGameBitmaps();
|
||||
}
|
||||
|
||||
// Load all the profiles to prepare things
|
||||
bool foundChosenProfileInLoadedProfiles = false;
|
||||
@ -1903,7 +1910,7 @@ namespace DisplayMagician.UIForms
|
||||
|
||||
private void btn_back_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
this.Hide();
|
||||
}
|
||||
|
||||
private void radiobutton_Paint(object sender, PaintEventArgs e)
|
||||
@ -2824,6 +2831,45 @@ namespace DisplayMagician.UIForms
|
||||
{
|
||||
txt_run_cmd_afterwards.Text = getExeFile();
|
||||
}
|
||||
|
||||
private void btn_refresh_games_list_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Change the mouse crusor so the user knows something is happening
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
// Empty the games list
|
||||
GameLibraries.GameLibrary.AllInstalledGamesInAllLibraries.Clear();
|
||||
// Load all the new games
|
||||
GameLibraries.GameLibrary.LoadGamesInBackground();
|
||||
// Parse the libraries
|
||||
GameLibraries.GameLibrary.RefreshGameBitmaps();
|
||||
// Load all the Games into the Games ListView
|
||||
ilv_games.Items.Clear();
|
||||
foreach (var game in DisplayMagician.GameLibraries.GameLibrary.AllInstalledGamesInAllLibraries.OrderBy(game => game.Name))
|
||||
{
|
||||
// Add the game to the game array
|
||||
ImageListViewItem newItem = new ImageListViewItem(game, game.Name);
|
||||
if (_editingExistingShortcut && game.Name.Equals(_shortcutToEdit.GameName))
|
||||
{
|
||||
newItem.Selected = true;
|
||||
}
|
||||
ilv_games.Items.Add(newItem, _gameAdaptor);
|
||||
}
|
||||
// Make sure that if the item is selected that it's visible
|
||||
if (ilv_games.SelectedItems.Count > 0)
|
||||
{
|
||||
int selectedIndex = ilv_games.SelectedItems[0].Index;
|
||||
ilv_games.EnsureVisible(selectedIndex);
|
||||
}
|
||||
|
||||
// Change the user cursor back
|
||||
this.Cursor = Cursors.Default;
|
||||
// Show we're done
|
||||
MessageBox.Show(
|
||||
@"The list of available games has been updated.",
|
||||
@"Games List Updated",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Exclamation);
|
||||
}
|
||||
}
|
||||
|
||||
// Class used to populate combo boxes
|
||||
|
@ -19,6 +19,7 @@ namespace DisplayMagician.UIForms
|
||||
|
||||
private ShortcutAdaptor _shortcutAdaptor = new ShortcutAdaptor();
|
||||
private ShortcutItem _selectedShortcut = null;
|
||||
private ShortcutForm _shortcutForm = null;
|
||||
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
|
||||
public ShortcutLibraryForm()
|
||||
@ -264,13 +265,16 @@ namespace DisplayMagician.UIForms
|
||||
private void btn_new_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
var shortcutForm = new ShortcutForm(new ShortcutItem(),false);
|
||||
//ShortcutRepository.IsValidRefresh();
|
||||
shortcutForm.ShowDialog(this);
|
||||
if (shortcutForm.DialogResult == DialogResult.OK)
|
||||
if (_shortcutForm == null)
|
||||
{
|
||||
ShortcutRepository.AddShortcut(shortcutForm.Shortcut);
|
||||
_selectedShortcut = shortcutForm.Shortcut;
|
||||
_shortcutForm = new ShortcutForm(new ShortcutItem(), false);
|
||||
}
|
||||
//ShortcutRepository.IsValidRefresh();
|
||||
_shortcutForm.ShowDialog(this);
|
||||
if (_shortcutForm.DialogResult == DialogResult.OK)
|
||||
{
|
||||
ShortcutRepository.AddShortcut(_shortcutForm.Shortcut);
|
||||
_selectedShortcut = _shortcutForm.Shortcut;
|
||||
//ShortcutRepository.IsValidRefresh();
|
||||
RefreshShortcutLibraryUI();
|
||||
}
|
||||
@ -313,10 +317,10 @@ namespace DisplayMagician.UIForms
|
||||
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
|
||||
var shortcutForm = new ShortcutForm(_selectedShortcut,true);
|
||||
_shortcutForm = new ShortcutForm(_selectedShortcut,true);
|
||||
//ilv_saved_shortcuts.SuspendLayout();
|
||||
shortcutForm.ShowDialog(this);
|
||||
if (shortcutForm.DialogResult == DialogResult.OK)
|
||||
_shortcutForm.ShowDialog(this);
|
||||
if (_shortcutForm.DialogResult == DialogResult.OK)
|
||||
{
|
||||
RefreshShortcutLibraryUI();
|
||||
// As this is an edit, we need to manually force saving the shortcut library
|
||||
|
Loading…
Reference in New Issue
Block a user