mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-02 02:24:38 +12:00
Using cached icon instead of loading it multiple times from resources
This prevents a potential crash if lots of icons cannot be loaded (see https://stackoverflow.com/questions/36446000/system-reflection-targetinvocationexception-in-resources-designer-vb ) Fixes #159
This commit is contained in:
parent
d894277d00
commit
2cea00c942
|
@ -22,6 +22,7 @@ namespace SystemTrayMenu.DataClasses
|
||||||
|
|
||||||
internal class RowData : IDisposable
|
internal class RowData : IDisposable
|
||||||
{
|
{
|
||||||
|
private static readonly Icon White50PercentageIcon = Properties.Resources.WhiteTransparency;
|
||||||
private static DateTime contextMenuClosed;
|
private static DateTime contextMenuClosed;
|
||||||
private string workingDirectory;
|
private string workingDirectory;
|
||||||
private string arguments;
|
private string arguments;
|
||||||
|
@ -76,14 +77,14 @@ namespace SystemTrayMenu.DataClasses
|
||||||
|
|
||||||
if (icon == null)
|
if (icon == null)
|
||||||
{
|
{
|
||||||
icon = Properties.Resources.WhiteTransparency;
|
icon = White50PercentageIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HiddenEntry)
|
if (HiddenEntry)
|
||||||
{
|
{
|
||||||
row[0] = IconReader.AddIconOverlay(
|
row[0] = IconReader.AddIconOverlay(
|
||||||
data.icon,
|
data.icon,
|
||||||
Properties.Resources.WhiteTransparency);
|
White50PercentageIcon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue