mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Made CurrentProfile work across instances
There is a caveat with that, that the one that is running first is the one that will generate the console output. This isn't what everyone would want unfortunately, as it may not be caught from a catch/powershell file. The 'DisplayMagician CurrentProfile' command will work perfectly if there are no other DisplayMagician's running, but because we have moved to a SIngleInstance model if there is already another DisplayMagician instance running, the instance started by the batch file will close and the batch file/powershell file won't get an answer :(. Nothing I can do about that I'm afraid.
This commit is contained in:
parent
28f7543fc3
commit
ee8d855d23
@ -68,11 +68,13 @@ namespace DisplayMagician {
|
||||
// If we're a subsequent instance, pass the command line parameters to the first instance and then
|
||||
bool isFirstInstance = SingleInstance.LaunchOrReturn(args);
|
||||
if (isFirstInstance)
|
||||
{
|
||||
{
|
||||
Console.WriteLine($"Program/Main: This is the first DisplayMagician to start, so will be the one to actually perform the actions.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// if we're the second instance of DisplayMagician, then lets close down as the first instance will continue with what we wanted to do.
|
||||
Console.WriteLine($"Program/Main: There is already another DisplayMagician running, so we'll use that one to actually perform the actions. Closing this instance of Displaymagician.");
|
||||
if (System.Windows.Forms.Application.MessageLoop)
|
||||
{
|
||||
@ -84,6 +86,7 @@ namespace DisplayMagician {
|
||||
// Console app
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If we get here, then we're the first instance!
|
||||
|
@ -26,8 +26,8 @@ using System.Resources;
|
||||
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
|
||||
|
||||
// Version information
|
||||
[assembly: AssemblyVersion("2.3.0.9")]
|
||||
[assembly: AssemblyFileVersion("2.3.0.9")]
|
||||
[assembly: AssemblyVersion("2.3.0.11")]
|
||||
[assembly: AssemblyFileVersion("2.3.0.11")]
|
||||
[assembly: NeutralResourcesLanguageAttribute( "en" )]
|
||||
[assembly: CLSCompliant(true)]
|
||||
|
||||
|
@ -80,6 +80,10 @@ namespace DisplayMagician
|
||||
logger.Trace($"SingleInstance/executeAnActionCallback: Other DisplayMagician instance provided the CreateProfile command: '{args[1]} {args[2]}'");
|
||||
Program.CreateProfile();
|
||||
break;
|
||||
case "CurrentProfile":
|
||||
logger.Trace($"SingleInstance/executeAnActionCallback: Other DisplayMagician instance provided the CurrentProfile command: '{args[1]} {args[2]}'");
|
||||
Program.CurrentProfile();
|
||||
break;
|
||||
default:
|
||||
logger.Warn($"SingleInstance/executeAnActionCallback: Other DisplayMagician instance provided an unsupported command: '{args[1]}'");
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user