mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Fixed Profile reverting after game execution
The ApplyProfile had some logic that would stop reverting the profile after the game/exe was exited. This should now be fixed. Also attempted a fix to centralise the timer circle in the middle window while applying a profile.
This commit is contained in:
parent
a5d581fec8
commit
ca1b760d9e
@ -301,9 +301,6 @@ namespace HeliosPlus {
|
||||
// ApplyProfile lives here so that the UI works.
|
||||
public static bool ApplyProfile(ProfileItem profile)
|
||||
{
|
||||
// If we're already on the wanted profile then no need to change!
|
||||
if (ProfileRepository.IsActiveProfile(profile))
|
||||
return true;
|
||||
|
||||
// We need to check if the profile is valid
|
||||
if (!profile.IsPossible)
|
||||
@ -384,11 +381,13 @@ namespace HeliosPlus {
|
||||
|
||||
if (applyTopologyTask.IsFaulted)
|
||||
Console.WriteLine("Program/ApplyProfile : Applying Profile Topology stage failed to complete");
|
||||
|
||||
if (!applyTopologyTask.IsCompleted)
|
||||
return false;
|
||||
}
|
||||
|
||||
// We always want to do the WindowsDisplayAPI PathInfo part
|
||||
pathInfoForm.ShowDialog();
|
||||
applyPathInfoTask.Wait();
|
||||
try
|
||||
{
|
||||
applyPathInfoTask.Wait();
|
||||
@ -413,9 +412,7 @@ namespace HeliosPlus {
|
||||
if (applyPathInfoTask.IsFaulted)
|
||||
Console.WriteLine("Program/ApplyProfile : Applying Profile PathInfo stage failed to complete");
|
||||
|
||||
if (applyTopologyTask.IsCompleted && applyPathInfoTask.IsCompleted)
|
||||
return true;
|
||||
else
|
||||
if (!applyPathInfoTask.IsCompleted)
|
||||
return false;
|
||||
|
||||
}
|
||||
@ -424,6 +421,8 @@ namespace HeliosPlus {
|
||||
Console.WriteLine($"ProfileRepository/ApplyTopology exception: {ex.Message}: {ex.StackTrace} - {ex.InnerException}");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool LoadGamesInBackground()
|
||||
|
@ -484,7 +484,6 @@ namespace HeliosPlus
|
||||
if (needToChangeProfiles)
|
||||
{
|
||||
// Apply the Profile!
|
||||
//if (!ProfileRepository.ApplyProfile(shortcutToUse.ProfileToUse))
|
||||
if (!Program.ApplyProfile(shortcutToUse.ProfileToUse))
|
||||
{
|
||||
throw new Exception(Language.Cannot_change_active_profile);
|
||||
|
@ -139,7 +139,9 @@ namespace HeliosPlus.UIForms
|
||||
{
|
||||
lock (_progressPositions)
|
||||
{
|
||||
|
||||
// Screen.Allscreens is a static variable and won't be updated while the program is running.
|
||||
// SO we use reflection to wipe the value and force it to be updated afresh.
|
||||
typeof(Screen).GetField("screens", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).SetValue(null, null);
|
||||
Screen[] screens = Screen.AllScreens;
|
||||
Size = screens.Select(screen => screen.Bounds)
|
||||
.Aggregate(Rectangle.Union)
|
||||
|
Loading…
Reference in New Issue
Block a user