Adjusted MainForm logic so it loads top most window

Now that we load a splashscreen, I've had to adjust the MainForm window display logic so that it goes to the topmost window when the user requests it to. This is much easier to use.
This commit is contained in:
Terry MacDonald 2021-10-30 19:38:21 +13:00
parent 913cf34d72
commit 9cdb1cb3f2
2 changed files with 22 additions and 9 deletions

View File

@ -26,8 +26,8 @@ using System.Resources;
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
// Version information
[assembly: AssemblyVersion("2.1.0.57")]
[assembly: AssemblyFileVersion("2.1.0.57")]
[assembly: AssemblyVersion("2.1.0.59")]
[assembly: AssemblyFileVersion("2.1.0.59")]
[assembly: NeutralResourcesLanguageAttribute( "en" )]
[assembly: CLSCompliant(true)]

View File

@ -125,6 +125,10 @@ namespace DisplayMagician.UIForms
}
}
// Shut down the splash screen
if (Program.AppProgramSettings.ShowSplashScreen && Program.AppSplashScreen != null && !Program.AppSplashScreen.Disposing && !Program.AppSplashScreen.IsDisposed)
Program.AppSplashScreen.Invoke(new Action(() => Program.AppSplashScreen.Close()));
if (Program.AppProgramSettings.MinimiseOnStart)
{
// Make the form minimised on start
@ -174,10 +178,6 @@ namespace DisplayMagician.UIForms
cb_minimise_notification_area.Checked = false;
}
// Shut down the splash screen
if (Program.AppProgramSettings.ShowSplashScreen && Program.AppSplashScreen != null && !Program.AppSplashScreen.Disposing && !Program.AppSplashScreen.IsDisposed)
Program.AppSplashScreen.Invoke(new Action(() => Program.AppSplashScreen.Close()));
// If we've been handed a Form of some kind, then open it straight away
if (formToOpen is DisplayProfileForm)
{
@ -189,6 +189,16 @@ namespace DisplayMagician.UIForms
var shortcutLibraryForm = new ShortcutLibraryForm();
shortcutLibraryForm.ShowDialog(this);
}
else
{
// Make this window top most if we're not minimised
if (!Program.AppProgramSettings.MinimiseOnStart)
{
this.TopMost = true;
this.Activate();
this.TopMost = false;
}
}
}
@ -427,6 +437,9 @@ namespace DisplayMagician.UIForms
Restore();
Show();
BringToFront();
this.TopMost = true;
this.Activate();
this.TopMost = false;
}
public void exitApplication()