From eef92abebfc5d3316ee606e74b72133643ca63ec Mon Sep 17 00:00:00 2001 From: Terry MacDonald Date: Thu, 2 Sep 2021 15:09:06 +1200 Subject: [PATCH] Fixed DisplayProfile ImageListView I'd managed to break the Display Profile imagelistview with one of my code clearing escapades, but now I have managed to fix it again! --- DisplayMagician/UIForms/ProfileAdaptor.cs | 9 ++++++++- DisplayMagicianShared/ProfileItem.cs | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/DisplayMagician/UIForms/ProfileAdaptor.cs b/DisplayMagician/UIForms/ProfileAdaptor.cs index fde8022..e3909dc 100644 --- a/DisplayMagician/UIForms/ProfileAdaptor.cs +++ b/DisplayMagician/UIForms/ProfileAdaptor.cs @@ -1,4 +1,7 @@ using DisplayMagicianShared; +using DisplayMagicianShared.NVIDIA; +using DisplayMagicianShared.AMD; +using DisplayMagicianShared.Windows; using Manina.Windows.Forms; using System; using System.Collections.Generic; @@ -62,8 +65,12 @@ namespace DisplayMagician.UIForms profileToUse = ProfileRepository.CurrentProfile; } + // Stop the callback doing anything Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(() => { return false; }); - return profileToUse.ProfileBitmap.GetThumbnailImage(size.Width, size.Height, myCallback, IntPtr.Zero); + + Image imageToUse; + imageToUse = profileToUse.ProfileBitmap.GetThumbnailImage(size.Width, size.Height, myCallback, IntPtr.Zero); + return imageToUse; } catch (Exception ex) { diff --git a/DisplayMagicianShared/ProfileItem.cs b/DisplayMagicianShared/ProfileItem.cs index f2cdc20..b96fd0e 100644 --- a/DisplayMagicianShared/ProfileItem.cs +++ b/DisplayMagicianShared/ProfileItem.cs @@ -564,6 +564,12 @@ namespace DisplayMagicianShared } public static bool operator !=(ProfileItem lhs, ProfileItem rhs) => !(lhs == rhs); + + // IMPORTANT - This ProfileItem ToString function is required to make the Profile ImageListView work properly! DO NOT DELETE! + public override string ToString() + { + return (Name ?? Language.UN_TITLED_PROFILE); + } } }