mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Added ApplyProfile exceptions and StartPrograms
This commit is contained in:
parent
12e3229f9d
commit
07d1c040cb
@ -310,6 +310,7 @@ namespace HeliosPlus {
|
|||||||
if (!ProfileRepository.ApplyNVIDIAGridTopology(profile))
|
if (!ProfileRepository.ApplyNVIDIAGridTopology(profile))
|
||||||
{
|
{
|
||||||
// Somehow return that this profile topology didn't apply
|
// Somehow return that this profile topology didn't apply
|
||||||
|
throw new ApplyTopologyException("Program/ApplyProfile: ApplyNVIDIAGridTopology: Error setting up the NVIDIA Surround Grid Topology");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -318,6 +319,7 @@ namespace HeliosPlus {
|
|||||||
if (!ProfileRepository.ApplyWindowsDisplayPathInfo(profile))
|
if (!ProfileRepository.ApplyWindowsDisplayPathInfo(profile))
|
||||||
{
|
{
|
||||||
// Somehow return that this profile path info didn't apply
|
// Somehow return that this profile path info didn't apply
|
||||||
|
throw new ApplyPathInfoException("Program/ApplyProfile: ApplyWindowsDisplayPathInfo: Error configuring the Windows Display Devices");
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -506,16 +506,17 @@ namespace HeliosPlus
|
|||||||
List<Process> startProgramsToStop = new List<Process>();
|
List<Process> startProgramsToStop = new List<Process>();
|
||||||
if (shortcutToUse.StartPrograms is List<StartProgram> && shortcutToUse.StartPrograms.Count > 0)
|
if (shortcutToUse.StartPrograms is List<StartProgram> && shortcutToUse.StartPrograms.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (StartProgram myStartProgram in shortcutToUse.StartPrograms
|
foreach (StartProgram processToStart in shortcutToUse.StartPrograms
|
||||||
.Where(program => program.Enabled == true && program.CloseOnFinish == true)
|
.Where(program => program.Enabled == true)
|
||||||
.OrderBy(program => program.Priority))
|
.OrderBy(program => program.Priority))
|
||||||
{
|
{
|
||||||
// Start the executable
|
// Start the executable
|
||||||
|
Console.WriteLine($"Starting process {processToStart.Executable}");
|
||||||
Process process = null;
|
Process process = null;
|
||||||
if (myStartProgram.ExecutableArgumentsRequired)
|
if (processToStart.ExecutableArgumentsRequired)
|
||||||
process = System.Diagnostics.Process.Start(myStartProgram.Executable, myStartProgram.Arguments);
|
process = System.Diagnostics.Process.Start(processToStart.Executable, processToStart.Arguments);
|
||||||
else
|
else
|
||||||
process = System.Diagnostics.Process.Start(myStartProgram.Executable);
|
process = System.Diagnostics.Process.Start(processToStart.Executable);
|
||||||
// Record t
|
// Record t
|
||||||
startProgramsToStop.Add(process);
|
startProgramsToStop.Add(process);
|
||||||
}
|
}
|
||||||
@ -657,7 +658,7 @@ namespace HeliosPlus
|
|||||||
IPCService.GetInstance().HoldProcessId = steamProcess?.Id ?? 0;
|
IPCService.GetInstance().HoldProcessId = steamProcess?.Id ?? 0;
|
||||||
IPCService.GetInstance().Status = InstanceStatus.OnHold;
|
IPCService.GetInstance().Status = InstanceStatus.OnHold;
|
||||||
|
|
||||||
// Add a status notification icon in the status area
|
/*// Add a status notification icon in the status area
|
||||||
NotifyIcon notify = null;
|
NotifyIcon notify = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -675,7 +676,7 @@ namespace HeliosPlus
|
|||||||
{
|
{
|
||||||
Console.WriteLine($"Program/SwitchToSteamGame exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
Console.WriteLine($"Program/SwitchToSteamGame exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Wait for the game to exit
|
// Wait for the game to exit
|
||||||
if (steamGameToRun.IsRunning)
|
if (steamGameToRun.IsRunning)
|
||||||
@ -692,13 +693,13 @@ namespace HeliosPlus
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove the status notification icon from the status area
|
// Remove the status notification icon from the status area
|
||||||
// once we've existed the game
|
// once we've exited the game
|
||||||
if (notify != null)
|
/*if (notify != null)
|
||||||
{
|
{
|
||||||
notify.Visible = false;
|
notify.Visible = false;
|
||||||
notify.Dispose();
|
notify.Dispose();
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -723,6 +724,7 @@ namespace HeliosPlus
|
|||||||
// Stop the programs in the reverse order we started them
|
// Stop the programs in the reverse order we started them
|
||||||
foreach (Process processToStop in startProgramsToStop.Reverse<Process>())
|
foreach (Process processToStop in startProgramsToStop.Reverse<Process>())
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"Stopping process {processToStop.StartInfo.FileName}");
|
||||||
// Stop the program
|
// Stop the program
|
||||||
processToStop.Close();
|
processToStop.Close();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user