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))
|
||||
{
|
||||
// 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))
|
||||
{
|
||||
// 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>();
|
||||
if (shortcutToUse.StartPrograms is List<StartProgram> && shortcutToUse.StartPrograms.Count > 0)
|
||||
{
|
||||
foreach (StartProgram myStartProgram in shortcutToUse.StartPrograms
|
||||
.Where(program => program.Enabled == true && program.CloseOnFinish == true)
|
||||
foreach (StartProgram processToStart in shortcutToUse.StartPrograms
|
||||
.Where(program => program.Enabled == true)
|
||||
.OrderBy(program => program.Priority))
|
||||
{
|
||||
// Start the executable
|
||||
Console.WriteLine($"Starting process {processToStart.Executable}");
|
||||
Process process = null;
|
||||
if (myStartProgram.ExecutableArgumentsRequired)
|
||||
process = System.Diagnostics.Process.Start(myStartProgram.Executable, myStartProgram.Arguments);
|
||||
if (processToStart.ExecutableArgumentsRequired)
|
||||
process = System.Diagnostics.Process.Start(processToStart.Executable, processToStart.Arguments);
|
||||
else
|
||||
process = System.Diagnostics.Process.Start(myStartProgram.Executable);
|
||||
process = System.Diagnostics.Process.Start(processToStart.Executable);
|
||||
// Record t
|
||||
startProgramsToStop.Add(process);
|
||||
}
|
||||
@ -657,7 +658,7 @@ namespace HeliosPlus
|
||||
IPCService.GetInstance().HoldProcessId = steamProcess?.Id ?? 0;
|
||||
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;
|
||||
try
|
||||
{
|
||||
@ -675,7 +676,7 @@ namespace HeliosPlus
|
||||
{
|
||||
Console.WriteLine($"Program/SwitchToSteamGame exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||
// ignored
|
||||
}
|
||||
}*/
|
||||
|
||||
// Wait for the game to exit
|
||||
if (steamGameToRun.IsRunning)
|
||||
@ -692,13 +693,13 @@ namespace HeliosPlus
|
||||
}
|
||||
|
||||
// Remove the status notification icon from the status area
|
||||
// once we've existed the game
|
||||
if (notify != null)
|
||||
// once we've exited the game
|
||||
/*if (notify != null)
|
||||
{
|
||||
notify.Visible = false;
|
||||
notify.Dispose();
|
||||
Application.DoEvents();
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@ -723,6 +724,7 @@ namespace HeliosPlus
|
||||
// Stop the programs in the reverse order we started them
|
||||
foreach (Process processToStop in startProgramsToStop.Reverse<Process>())
|
||||
{
|
||||
Console.WriteLine($"Stopping process {processToStop.StartInfo.FileName}");
|
||||
// Stop the program
|
||||
processToStop.Close();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user