mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
enhance: cache for external tool icons
This commit is contained in:
parent
78ef955002
commit
71b9b3dfea
1 changed files with 18 additions and 11 deletions
|
@ -21,20 +21,24 @@ namespace SourceGit.Models
|
|||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Icon))
|
||||
if (_isFirstTimeGetIcon)
|
||||
{
|
||||
return null;
|
||||
_isFirstTimeGetIcon = false;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Icon))
|
||||
{
|
||||
try
|
||||
{
|
||||
var icon = AssetLoader.Open(new Uri($"avares://SourceGit/Resources/ExternalToolIcons/{Icon}.png", UriKind.RelativeOrAbsolute));
|
||||
_iconImage = new Bitmap(icon);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var icon = AssetLoader.Open(new Uri($"avares://SourceGit/Resources/ExternalToolIcons/{Icon}.png", UriKind.RelativeOrAbsolute));
|
||||
return new Bitmap(icon);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return _iconImage;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,6 +52,9 @@ namespace SourceGit.Models
|
|||
UseShellExecute = false,
|
||||
});
|
||||
}
|
||||
|
||||
private bool _isFirstTimeGetIcon = true;
|
||||
private Bitmap _iconImage = null;
|
||||
}
|
||||
|
||||
public class JetBrainsState
|
||||
|
|
Loading…
Reference in a new issue