From 9cdb1cb3f2d19b6b617d8ab73e7480a360b61281 Mon Sep 17 00:00:00 2001 From: Terry MacDonald Date: Sat, 30 Oct 2021 19:38:21 +1300 Subject: [PATCH] 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. --- DisplayMagician/Properties/AssemblyInfo.cs | 4 ++-- DisplayMagician/UIForms/MainForm.cs | 27 ++++++++++++++++------ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/DisplayMagician/Properties/AssemblyInfo.cs b/DisplayMagician/Properties/AssemblyInfo.cs index b6e150f..266d411 100644 --- a/DisplayMagician/Properties/AssemblyInfo.cs +++ b/DisplayMagician/Properties/AssemblyInfo.cs @@ -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)] diff --git a/DisplayMagician/UIForms/MainForm.cs b/DisplayMagician/UIForms/MainForm.cs index ea2d80f..1c1c378 100644 --- a/DisplayMagician/UIForms/MainForm.cs +++ b/DisplayMagician/UIForms/MainForm.cs @@ -123,7 +123,11 @@ namespace DisplayMagician.UIForms MessageBoxIcon.Error); } } - } + } + + // 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) { @@ -173,11 +177,7 @@ 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,8 +189,18 @@ 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; + } + } - } + } protected override void SetVisibleCore(bool value) { @@ -427,6 +437,9 @@ namespace DisplayMagician.UIForms Restore(); Show(); BringToFront(); + this.TopMost = true; + this.Activate(); + this.TopMost = false; } public void exitApplication()