Part 2 of the move to a single ProfileItem

Mostly works now! Only bit still needing work is the Avtive profile detection to detect the non-surround profile when we return from surround. I think it's to do with the windows display number changing :(. I need to check that.
This commit is contained in:
Terry MacDonald 2021-09-07 22:08:54 +12:00
parent f8e9eecf81
commit fef3dbf1e0
3 changed files with 14 additions and 38 deletions

View File

@ -202,7 +202,7 @@ namespace DisplayMagician.UIForms
// if the item was removed from the list during this
// list refresh, then we select this profile only if it
// is the currently used Profile
if (ProfileRepository.IsActiveProfile(_selectedProfile))
if (profile.Equals(_selectedProfile))
newItem.Selected = true;
// Add it to the list!

View File

@ -522,10 +522,13 @@ namespace DisplayMagicianShared
}
}
public virtual bool PerformPostLoadingTasks()
/*public bool PerformPostLoadingTasks()
{
return false;
}
// First thing we do is to set up the Screens
//_screens = GetScreenPositions();
return true;
}*/
// ReSharper disable once FunctionComplexityOverflow
@ -1474,7 +1477,6 @@ namespace DisplayMagicianShared
// Check the object fields
// ProfileDisplayIdentifiers may be the same but in different order within the array, so we need to handle
// that fact.
int ourMatchedIds = 0;
return NVIDIADisplayConfig.Equals(other.NVIDIADisplayConfig) &&
//AMDDisplayConfig.Equals(other.AMDDisplayConfig) &&
WindowsDisplayConfig.Equals(other.WindowsDisplayConfig) &&
@ -1489,6 +1491,7 @@ namespace DisplayMagicianShared
if (ReferenceEquals(this, obj)) return true;
// If different types then can't be true
if (obj.GetType() == this.GetType()) return false;
if (!(obj is ProfileItem)) return false;
// Check the object fields as this must the same object as obj, and we need to test in more detail
return Equals((ProfileItem) obj);
}

View File

@ -706,41 +706,14 @@ namespace DisplayMagicianShared
SharedLogger.logger.Debug($"ProfileRepository/LoadProfiles: Finding the current profile in the Profile Repository");
/*// Go through all the profiles and set up the needed structures (such as the Screens list)
// Go through all the profiles and set up the needed structures (such as the Screens list)
// and check if the current profile is used
foreach (ProfileItem loadedProfile in _allProfiles)
/*foreach (ProfileItem loadedProfile in _allProfiles)
{
if (loadedProfile.VideoMode == VIDEO_MODE.NVIDIA)
{
// NVIDIA config!
SharedLogger.logger.Debug($"ProfileRepository/LoadProfiles: Profile {loadedProfile.Name} is a NVIDIA Profile");
NVIDIAProfileItem nvidiaLoadedProfile = (NVIDIAProfileItem)loadedProfile;
nvidiaLoadedProfile.PerformPostLoadingTasks();
if (ProfileRepository.IsActiveProfile(nvidiaLoadedProfile))
_currentProfile = nvidiaLoadedProfile;
}
else if (loadedProfile is AMDProfileItem)
{
// AMD config!
SharedLogger.logger.Debug($"ProfileRepository/LoadProfiles: Profile {loadedProfile.Name} is an AMD Profile");
AMDProfileItem amdLoadedProfile = (AMDProfileItem) loadedProfile;
amdLoadedProfile.PerformPostLoadingTasks();
if (ProfileRepository.IsActiveProfile(amdLoadedProfile))
_currentProfile = amdLoadedProfile;
}
else if (loadedProfile is WinProfileItem)
{
// Windows CCD config!
SharedLogger.logger.Debug($"ProfileRepository/LoadProfiles: Profile {loadedProfile.Name} is a Windows Profile");
WinProfileItem winLoadedProfile = (WinProfileItem)loadedProfile;
winLoadedProfile.PerformPostLoadingTasks();
if (ProfileRepository.IsActiveProfile(winLoadedProfile))
_currentProfile = winLoadedProfile;
}
else
{
SharedLogger.logger.Error($"ProfileRepository/LoadProfiles: ERROR - Profile {loadedProfile.Name} is not a recognised profile!");
}
loadedProfile.PerformPostLoadingTasks();
*//*if (ProfileRepository.IsActiveProfile(loadedProfile))
_currentProfile = loadedProfile;*//*
}*/
// Sort the profiles alphabetically