mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Fixed excessive config gathering
The NVAPI and Windows APIs were checked multiple times in a row due to a logic error. THis has been partially corrected, but needs a lot of work to straighten it out.
This commit is contained in:
parent
076f9524cd
commit
9827cfac9a
@ -26,8 +26,8 @@ using System.Resources;
|
||||
[assembly: Guid("e4ceaf5e-ad01-4695-b179-31168eb74c48")]
|
||||
|
||||
// Version information
|
||||
[assembly: AssemblyVersion("2.4.0.43")]
|
||||
[assembly: AssemblyFileVersion("2.4.0.43")]
|
||||
[assembly: AssemblyVersion("2.4.0.48")]
|
||||
[assembly: AssemblyFileVersion("2.4.0.48")]
|
||||
[assembly: NeutralResourcesLanguageAttribute( "en" )]
|
||||
[assembly: CLSCompliant(true)]
|
||||
|
||||
|
@ -59,7 +59,8 @@ namespace DisplayMagician.UIForms
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ProfileRepository.UserChangingProfiles = true;
|
||||
|
||||
// Apply the Profile
|
||||
//if (ProfileRepository.ApplyProfile(_selectedProfile) == ApplyProfileResult.Successful)
|
||||
ApplyProfileResult result = Program.ApplyProfileTask(_selectedProfile);
|
||||
@ -83,6 +84,8 @@ namespace DisplayMagician.UIForms
|
||||
|
||||
// Recenter the Window
|
||||
RecenterWindow();
|
||||
|
||||
ProfileRepository.UserChangingProfiles = false;
|
||||
}
|
||||
|
||||
private void RecenterWindow()
|
||||
@ -543,6 +546,7 @@ namespace DisplayMagician.UIForms
|
||||
|
||||
private void btn_view_current_Click(object sender, EventArgs e)
|
||||
{
|
||||
ProfileRepository.UserChangingProfiles = true;
|
||||
// Refresh the profiles to see whats valid
|
||||
ProfileRepository.IsPossibleRefresh();
|
||||
// Reload the profiles in case we swapped to another program to change it
|
||||
@ -553,6 +557,7 @@ namespace DisplayMagician.UIForms
|
||||
RefreshDisplayProfileUI();
|
||||
// Recenter the Window
|
||||
RecenterWindow();
|
||||
ProfileRepository.UserChangingProfiles = false;
|
||||
}
|
||||
|
||||
private void txt_profile_save_name_KeyDown(object sender, KeyEventArgs e)
|
||||
@ -593,7 +598,10 @@ namespace DisplayMagician.UIForms
|
||||
|
||||
case WM_DISPLAYCHANGE:
|
||||
logger.Trace($"DisplayProfileForm/WndProc: Windows just sent a msg telling us the display has changed. Updating the current view by running btn_view_current.");
|
||||
btn_view_current.PerformClick();
|
||||
if (!ProfileRepository.UserChangingProfiles)
|
||||
{
|
||||
btn_view_current.PerformClick();
|
||||
}
|
||||
break;
|
||||
|
||||
// This auto taskbar detection logic just doesn't work at the moment
|
||||
|
@ -61,6 +61,7 @@ namespace DisplayMagicianShared
|
||||
private static VIDEO_MODE _currentVideoMode = VIDEO_MODE.WINDOWS;
|
||||
private static FORCED_VIDEO_MODE _forcedVideoMode = FORCED_VIDEO_MODE.DETECT;
|
||||
private static bool _pauseReadsUntilChangeCompleted = false;
|
||||
private static bool _userChangingProfiles = false;
|
||||
|
||||
// Other constants that are useful
|
||||
public static string AppDataPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "DisplayMagician");
|
||||
@ -225,6 +226,18 @@ namespace DisplayMagicianShared
|
||||
}
|
||||
}
|
||||
|
||||
public static bool UserChangingProfiles
|
||||
{
|
||||
get
|
||||
{
|
||||
return _userChangingProfiles;
|
||||
}
|
||||
set
|
||||
{
|
||||
_userChangingProfiles = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Class Methods
|
||||
@ -1298,6 +1311,8 @@ namespace DisplayMagicianShared
|
||||
// We stop the stop watch
|
||||
stopWatch.Stop();
|
||||
_pauseReadsUntilChangeCompleted = false;
|
||||
// Pause for a bit to let things settle
|
||||
Thread.Sleep(500);
|
||||
// Get the elapsed time as a TimeSpan value.
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
string result = "failed";
|
||||
@ -1374,7 +1389,7 @@ namespace DisplayMagicianShared
|
||||
}
|
||||
}
|
||||
|
||||
if (_currentVideoMode == VIDEO_MODE.NVIDIA)
|
||||
if (_currentVideoMode == VIDEO_MODE.NVIDIA && !(nvidiaLibrary is NVIDIALibrary))
|
||||
{
|
||||
// Initialise the the NVIDIA NvAPI Library
|
||||
try
|
||||
@ -1388,7 +1403,7 @@ namespace DisplayMagicianShared
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (_currentVideoMode == VIDEO_MODE.AMD)
|
||||
else if (_currentVideoMode == VIDEO_MODE.AMD && !(amdLibrary is AMDLibrary))
|
||||
{
|
||||
// Initialise the the AMD ADL Library
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user