Attempt to open the singleInstance if passed no command parameters

Also attempted to set the system tray notification popup correctly after a shortcut has been run.
This commit is contained in:
Terry MacDonald 2022-04-06 23:07:06 +12:00
parent 17a23009ff
commit 412ac2c855
3 changed files with 23 additions and 18 deletions

View File

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

View File

@ -2038,6 +2038,19 @@ namespace DisplayMagician
logger.Debug($"ShortcutRepository/RunShortcut: Shortcut did not require changing Display Profile, so no need to change it back.");
}
// Reset the popup over the system tray icon to what's normal for it.
// Set the notifyIcon text with the current profile
if (myMainForm.InvokeRequired)
{
myMainForm.BeginInvoke((MethodInvoker)delegate {
myMainForm.UpdateNotifyIconText($"DisplayMagician ({ProfileRepository.CurrentProfile.Name})");
});
}
else
{
myMainForm.UpdateNotifyIconText($"DisplayMagician ({ProfileRepository.CurrentProfile.Name})");
}
// And finally run the stop program we have
if (shortcutToUse.StopPrograms.Count > 0)
{
@ -2092,21 +2105,6 @@ namespace DisplayMagician
}
// Reset the popup over the system tray icon to what's normal for it.
// Set the notifyIcon text with the current profile
if (myMainForm.InvokeRequired)
{
myMainForm.BeginInvoke((MethodInvoker)delegate {
myMainForm.UpdateNotifyIconText($"DisplayMagician ({ProfileRepository.CurrentProfile.Name})");
});
}
else
{
myMainForm.UpdateNotifyIconText($"DisplayMagician ({ProfileRepository.CurrentProfile.Name})");
}
// If we're running DisplayMagician from a Desktop Shortcut and then shutting down again, then it will quit, leaving behind a desktop icon
// We need to remove that Desktopicon to tidy up in that case.
if (temporaryMainForm)

View File

@ -95,7 +95,14 @@ namespace DisplayMagician
}
else
{
logger.Warn($"SingleInstance/executeAnActionCallback: Other DisplayMagician instance didn't provide any commandline arguments at all. THat's not supposed to happen.");
logger.Warn($"SingleInstance/executeAnActionCallback: Other DisplayMagician instance didn't provide any commandline arguments at all so bringing the topmost window to the foreground.");
foreach (Form aForm in Application.OpenForms)
{
if (aForm.TopMost)
{
aForm.Activate();
}
}
}
}