Temporarily force DisplayMagician to wait for games to load

This is a test to see if this fixes the missing Steam games in large Steam libraries issue (#49).
This commit is contained in:
Terry MacDonald 2021-10-31 10:00:57 +13:00
parent 340e1a6db0
commit 613283da41
4 changed files with 44 additions and 20 deletions

View File

@ -317,7 +317,8 @@ namespace DisplayMagician {
app.Command(DisplayMagicianStartupAction.RunShortcut.ToString(), (runShortcutCmd) =>
{
// Try to load all the games in parallel to this process
Task.Run(() => LoadGamesInBackground());
//Task.Run(() => LoadGamesInBackground());
LoadGamesInBackground();
// Set the --trace or --debug options if supplied
if (trace.HasValue())
@ -591,16 +592,17 @@ namespace DisplayMagician {
}
}
logger.Info("Starting Normally...");
// Try to load all the games in parallel to this process
Task.Run(() => LoadGamesInBackground());
//Task.Run(() => LoadGamesInBackground());
logger.Debug($"Try to load all the Games in the background to avoid locking the UI");
LoadGamesInBackground();
StartUpApplication();
return 0;
});
logger.Debug($"Try to load all the Games in the background to avoid locking the UI");
if (AppProgramSettings.ShowSplashScreen)
{
//Show Splash Form
@ -609,7 +611,6 @@ namespace DisplayMagician {
() => Application.Run(AppSplashScreen)));
splashThread.SetApartmentState(ApartmentState.STA);
splashThread.Start();
}
try
@ -662,6 +663,7 @@ namespace DisplayMagician {
IPCService.GetInstance().Status = InstanceStatus.User;
// Close the splash screen
if (ProgramSettings.LoadSettings().ShowSplashScreen && AppSplashScreen != null && !AppSplashScreen.Disposing && !AppSplashScreen.IsDisposed)
AppSplashScreen.Invoke(new Action(() => AppSplashScreen.Close()));
@ -735,7 +737,7 @@ namespace DisplayMagician {
// Run the program with normal startup
AppMainForm = new MainForm();
//AppMainForm.Load += MainForm_LoadCompleted;
AppMainForm.Load += MainForm_LoadCompleted;
Application.Run(AppMainForm);
}
@ -768,6 +770,10 @@ namespace DisplayMagician {
ShortcutItem shortcutToRun = null;
// Close the splash screen
if (ProgramSettings.LoadSettings().ShowSplashScreen && AppSplashScreen != null && !AppSplashScreen.Disposing && !AppSplashScreen.IsDisposed)
AppSplashScreen.Invoke(new Action(() => AppSplashScreen.Close()));
// Check there is only one version of this application so we won't
// mess with another monitoring session
if (
@ -795,9 +801,6 @@ namespace DisplayMagician {
throw new Exception(Language.Cannot_find_shortcut_in_library);
}
if (ProgramSettings.LoadSettings().ShowSplashScreen && AppSplashScreen != null && !AppSplashScreen.Disposing && !AppSplashScreen.IsDisposed)
AppSplashScreen.Invoke(new Action(() => AppSplashScreen.Close()));
if (shortcutToRun is ShortcutItem)
{
ShortcutRepository.RunShortcut(shortcutToRun);
@ -821,13 +824,14 @@ namespace DisplayMagician {
{
logger.Trace($"Program/RunProfile: Starting");
// Close the splash screen
if (ProgramSettings.LoadSettings().ShowSplashScreen && AppSplashScreen != null && !AppSplashScreen.Disposing && !AppSplashScreen.IsDisposed)
AppSplashScreen.Invoke(new Action(() => AppSplashScreen.Close()));
// Lookup the profile
ProfileItem profileToUse = ProfileRepository.AllProfiles.Where(p => p.UUID.Equals(profileName)).First();
logger.Trace($"Program/RunProfile: Found profile called {profileName} and now starting to apply the profile");
if (ProgramSettings.LoadSettings().ShowSplashScreen && AppSplashScreen != null && !AppSplashScreen.Disposing && !AppSplashScreen.IsDisposed)
AppSplashScreen.Invoke(new Action(() => AppSplashScreen.Close()));
ProfileRepository.ApplyProfile(profileToUse);
}

View File

@ -629,6 +629,7 @@ namespace DisplayMagician
@"Cannot run the Shortcut",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
return;
}

View File

@ -15,6 +15,7 @@ namespace DisplayMagician.UIForms
public LoadingForm()
{
InitializeComponent();
this.TopMost = false;
}
}
}

View File

@ -69,6 +69,12 @@ namespace DisplayMagician.UIForms
{
logger.Warn($"DisplayProfileForm/Apply_Click: Error applying the Profile {_selectedProfile.Name}. Unable to change the display layout.");
}
// Also refresh the right-click menu (if we have a main form loaded)
if (Program.AppMainForm is Form)
{
Program.AppMainForm.RefreshNotifyIconMenus();
}
}
@ -124,6 +130,12 @@ namespace DisplayMagician.UIForms
}
// Also refresh the right-click menu (if we have a main form loaded)
if (Program.AppMainForm is Form)
{
Program.AppMainForm.RefreshNotifyIconMenus();
}
}
private void Save_Click(object sender, EventArgs e)
@ -178,6 +190,7 @@ namespace DisplayMagician.UIForms
{
MessageBox.Show(ex.Message, Language.Shortcut, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
@ -223,13 +236,6 @@ namespace DisplayMagician.UIForms
}
// Also refresh the right-click menu (if we have a main form loaded)
if (Program.AppMainForm is Form)
{
Program.AppMainForm.RefreshNotifyIconMenus();
}
// Restart updating the saved_profiles listview
ilv_saved_profiles.ResumeLayout();
}
@ -332,6 +338,12 @@ namespace DisplayMagician.UIForms
// Refresh the image list view
//RefreshImageListView(profile);
// Also refresh the right-click menu (if we have a main form loaded)
if (Program.AppMainForm is Form)
{
Program.AppMainForm.RefreshNotifyIconMenus();
}
// And finally refresh the profile in the display view
dv_profile.Profile = profile;
dv_profile.Refresh();
@ -432,6 +444,12 @@ namespace DisplayMagician.UIForms
// now update the profiles image listview
RefreshDisplayProfileUI();
// Also refresh the right-click menu (if we have a main form loaded)
if (Program.AppMainForm is Form)
{
Program.AppMainForm.RefreshNotifyIconMenus();
}
}
private void ilv_saved_profiles_ItemClick(object sender, ItemClickEventArgs e)