Skip to content

Commit

Permalink
Fix mainwindow flickering if thunbnail fails to load [#55]
Browse files Browse the repository at this point in the history
  • Loading branch information
t0815 committed Oct 18, 2024
1 parent d1a9e5e commit b9f9874
Show file tree
Hide file tree
Showing 10 changed files with 454 additions and 406 deletions.
2 changes: 1 addition & 1 deletion MyCBZ/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
<applicationSettings>
<Win_CBZ.Win_CBZSettings>
<setting name="InstalledVersion" serializeAs="String">
<value>0.22.179b</value>
<value>0.22.180b</value>
</setting>
<setting name="RenamerPlaceholders" serializeAs="Xml">
<value>
Expand Down
801 changes: 414 additions & 387 deletions MyCBZ/Forms/MainForm.Designer.cs

Large diffs are not rendered by default.

20 changes: 16 additions & 4 deletions MyCBZ/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,11 @@ public void ReloadPreviewThumbs()
}
catch (Exception e)
{
MessageLogger.Instance.Log(LogMessageEvent.LOGMESSAGE_TYPE_WARNING, "Error generating Thumbnail for Page '" + page.Name + "' (" + page.Id + ") [" + e.Message + "]");
if (!page.ThumbnailError)
{
page.ThumbnailError = true;
MessageLogger.Instance.Log(LogMessageEvent.LOGMESSAGE_TYPE_WARNING, "Error generating Thumbnail for Page '" + page.Name + "' (" + page.Id + ") [" + e.Message + "]");
}
}
}
}));
Expand Down Expand Up @@ -1412,7 +1416,11 @@ public void LoadThumbnailSlice(object threadParams)
}
catch (Exception e)
{
MessageLogger.Instance.Log(LogMessageEvent.LOGMESSAGE_TYPE_WARNING, "Error generating Thumbnail for Page '" + page.Name + "' (" + page.Id + ") [" + e.Message + "]");
if (!page.ThumbnailError)
{
page.ThumbnailError = true;
MessageLogger.Instance.Log(LogMessageEvent.LOGMESSAGE_TYPE_WARNING, "Error generating Thumbnail for Page '" + page.Name + "' (" + page.Id + ") [" + e.Message + "]");
}
}
finally
{
Expand Down Expand Up @@ -1603,7 +1611,11 @@ public void LoadImageInfoSlice(object threadParams)
}
catch (Exception e)
{
MessageLogger.Instance.Log(LogMessageEvent.LOGMESSAGE_TYPE_WARNING, "Error loading Image-Info for Page '" + page.Name + "' (" + page.Id + ") [" + e.Message + "]");
if (!page.ThumbnailError)
{
page.ThumbnailError = true;
MessageLogger.Instance.Log(LogMessageEvent.LOGMESSAGE_TYPE_WARNING, "Error loading Image-Info for Page '" + page.Name + "' (" + page.Id + ") [" + e.Message + "]");
}
}
finally
{
Expand Down Expand Up @@ -7370,7 +7382,7 @@ private void PageThumbsListBox_DrawItem(object sender, DrawItemEventArgs e)
{
e.Graphics.DrawImage(global::Win_CBZ.Properties.Resources.placeholder_image, new Point(center + 2, e.Bounds.Y + 4));

if (!page.Closed)
if (!page.Closed && !page.ThumbnailError)
{
if (ThumbnailPagesSlice.IndexOf(page) == -1)
{
Expand Down
12 changes: 6 additions & 6 deletions MyCBZ/Forms/MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs
LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu
SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAbgoAAAJNU0Z0AUkBTAIBAQMB
AAGwAS8BsAEvARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMAAUADAAEQAwABAQEAAQgG
AAH4AS8B+AEvARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMAAUADAAEQAwABAQEAAQgG
AAEEGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEAAfABygGmAQABMwUAATMB
AAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEAAYABfAH/AQACUAH/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8BIQEACP8BQgFNATYHAAE2AwABKAMAAUADAAFAAwABAQEAASAGAAFA/wAb
AAFQARABUAIQAQABEAEABP8BIQEACP8BQgFNATYHAAE2AwABKAMAAUADAAFAAwABAQEAASAGAAFA/wAb
AANMAZADJQH/A2IB4QgAAyQBNAMlAf8DJQH/AyoBP2AAAVUCVwGxAVwCZQHnASsCfgH8ASsCfgH8AVwC
ZQHnAVUCVwGxZAADMgFPAyUB/wMlAf8DGgEkBAAEAgNZAe8DJQH/A0YBgCQAAwYBCANBAXIDWwHNA1wB
+ANcAfgDWwHNA0EBcgMGAQgcAAFAAkEBcQEAAdIB+gH/AQAB0gH6Af8BAAHSAfoB/wEAAdIB+gH/AUAC
Expand Down Expand Up @@ -712,7 +712,7 @@ Note: If writing XML-Pageindex is set to FALSE, this option will be forced and c
AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs
LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu
SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAlgYAAAJNU0Z0AUkBTAIBAQIB
AAFgAQ8BYAEPARABAAEQAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABQAMAARADAAEBAQABIAYAARD/
AAGoAQ8BqAEPARABAAEQAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABQAMAARADAAEBAQABIAYAARD/
ACcAAxgBIQNQAZwDWgHyA1ABnAMYASHkAAMYASADTwGZA1oB8gNRAaIDJQH/A1EBogNaAfIDTwGZAxgB
IBQAA1kBwANZAcADWQHAA1kBwANZAcADWQHAA1kBwANZAcADWQHAA1kBwANZAcADWQHAA1kBwAMlAf8D
KgFAhAADFQEcA04BlgNaAfIDUQGeAxoBIwMIAQoDJQH/AwgBCgMaASMDUQGeA1oB8gNOAZYDFQEcDAAD
Expand Down Expand Up @@ -750,7 +750,7 @@ Note: If writing XML-Pageindex is set to FALSE, this option will be forced and c
AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs
LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu
SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAACgMAAAJNU0Z0AUkBTAIBAQIB
AAEgAS8BIAEvARABAAEQAQAE/wEZAQAI/wFCAU0BNgcAATYDAAEoAwABQAMAARADAAEBAQABGAYAAQwh
AAFoAS8BaAEvARABAAEQAQAE/wEZAQAI/wFCAU0BNgcAATYDAAEoAwABQAMAARADAAEBAQABGAYAAQwh
AAP3A9kDxAO/A9ID7QP+pQAD/gO5AywPJQN/A/0SAAPnAVIBVAFVA/oPAAO4AbYCuG8AA/sDhgYlA0kD
qwOtA38GJQNEA+MMAAPmA1ADJQN9A/oGAAP9A7QDKwMlA7ppAAP+A2MJJQObBgAD3wklA0QD/QYAA+cM
JQNGA/oDAAO0DCUBtgK4ZgAD1AwlA5sGAAPfDCUDfwP+AwAD6AM1DCUDfQO0AysJJQMrA7hmAAOGDCUD
Expand Down Expand Up @@ -779,7 +779,7 @@ Note: If writing XML-Pageindex is set to FALSE, this option will be forced and c
AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs
LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu
SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAuAsAAAJNU0Z0AUkBTAIBAQQB
AAFIAQ0BSAENARABAAEQAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABQAMAASADAAEBAQABIAYAASD/
AAGQAQ0BkAENARABAAEQAQAE/wEhAQAI/wFCAU0BNgcAATYDAAEoAwABQAMAASADAAEBAQABIAYAASD/
AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/ADYAAxgBIAM4AVsDRAF4A0YBfgM8AWYDJQE3AwQB
BdwAAwQBBQNJAYUDTQH6A1wB5wNRAaQDTgGWA10BzAMlAf8DWAG9AwcBCVwAAxMBGgNJAYgBXQJhAdQB
RQFoAWoB+QFFAWgBagH5AV0CYQHUA0kBiAMTARowAAM4AV0DMAFKAwQBBRwAAw4BEgNVAbQDVQGsAy0B
Expand Down
9 changes: 9 additions & 0 deletions MyCBZ/Models/Page.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ internal class Page

public bool ThumbnailInvalidated { get; set; }

public bool ThumbnailError { get; set; }

public int Index { get; set; }

public int OriginalIndex { get; set; }
Expand Down Expand Up @@ -1995,6 +1997,7 @@ public Image GetThumbnail(int w = 0, int h = 0)

if (Image != null)
{
ThumbnailError = false;
try
{
var newBitmap = new Bitmap(w, h);
Expand All @@ -2011,6 +2014,7 @@ public Image GetThumbnail(int w = 0, int h = 0)
}
catch (Exception et)
{
ThumbnailError = true;
throw new PageException(this, et.Message, true, et);
} finally
{
Expand Down Expand Up @@ -2040,6 +2044,7 @@ public Bitmap GetThumbnailBitmap(int w = 0, int h = 0)

if (Image != null)
{
ThumbnailError = false;
try
{
var newBitmap = new Bitmap(w, h);
Expand All @@ -2057,6 +2062,8 @@ public Bitmap GetThumbnailBitmap(int w = 0, int h = 0)
}
catch (Exception et)
{
ThumbnailError = true;

throw new PageException(this, et.Message, true, et);
}
finally
Expand All @@ -2081,6 +2088,7 @@ public Image GetWindowsThumbnail(Image.GetThumbnailImageAbort callback, IntPtr c

if (Image != null)
{
ThumbnailError = false;
try
{
Thumbnail = Image.GetThumbnailImage(ThumbW, ThumbH, callback, callbackData);
Expand All @@ -2089,6 +2097,7 @@ public Image GetWindowsThumbnail(Image.GetThumbnailImageAbort callback, IntPtr c
Image = null;
} catch (Exception ex)
{
ThumbnailError = true;
throw new PageException(this, ex.Message, true, ex);
}
}
Expand Down
4 changes: 2 additions & 2 deletions MyCBZ/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.22.179")]
[assembly: AssemblyFileVersion("0.22.179")]
[assembly: AssemblyVersion("0.22.180")]
[assembly: AssemblyFileVersion("0.22.180")]
[assembly: NeutralResourcesLanguage("en")]
2 changes: 1 addition & 1 deletion MyCBZ/Win_CBZSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion MyCBZ/Win_CBZSettings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Value Profile="(Default)">%APPDATA%\WIN_CBZ\Temp\</Value>
</Setting>
<Setting Name="InstalledVersion" Type="System.String" Scope="Application">
<Value Profile="(Default)">0.22.179b</Value>
<Value Profile="(Default)">0.22.180b</Value>
</Setting>
<Setting Name="RenamerPlaceholders" Type="System.Collections.Specialized.StringCollection" Scope="Application">
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Microsoft Visual Studio [Community] 2022 (64-Bit)

## Latest Release

v0.22.179b released!
v0.22.180b released!


>[!IMPORTANT]
Expand Down
6 changes: 3 additions & 3 deletions Win_CBZ-Setup/Win_CBZ-Setup.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Win_CBZ"
"ProductCode" = "8:{1E6C991D-AADE-4271-AED3-C66E37AB63BD}"
"PackageCode" = "8:{E6B9379A-9313-417C-B49E-8EFE2B39BE4E}"
"ProductCode" = "8:{4625E64F-63F5-47AA-B42B-C2DE480A4C96}"
"PackageCode" = "8:{19AA5FAF-43FD-4052-A489-3D92FD365C23}"
"UpgradeCode" = "8:{66FAEF81-1CAE-4971-9E0F-796310EFEA5E}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:0.22.179"
"ProductVersion" = "8:0.22.180"
"Manufacturer" = "8:Trash_s0Ft"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
Expand Down

0 comments on commit b9f9874

Please sign in to comment.