add dedicated missing img icon

This commit is contained in:
Jeremy Wu 2020-09-07 06:55:12 +10:00
parent e5ba262788
commit d3fbabe10e
6 changed files with 12 additions and 10 deletions

BIN
Doc/app_missing_img.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View file

@ -23,8 +23,10 @@ namespace Flow.Launcher.Infrastructure
public static readonly string Version = FileVersionInfo.GetVersionInfo(Assembly.Location.NonNull()).ProductVersion;
public static readonly int ThumbnailSize = 64;
public static readonly string DefaultIcon = Path.Combine(ProgramDirectory, "Images", "app.png");
public static readonly string ErrorIcon = Path.Combine(ProgramDirectory, "Images", "app_error.png");
private static readonly string ImagesDirectory = Path.Combine(ProgramDirectory, "Images");
public static readonly string DefaultIcon = Path.Combine(ImagesDirectory, "app.png");
public static readonly string ErrorIcon = Path.Combine(ImagesDirectory, "app_error.png");
public static readonly string MissingImgIcon = Path.Combine(ImagesDirectory, "app_missing_img.png");
public static string PythonPath;

View file

@ -38,7 +38,7 @@ namespace Flow.Launcher.Infrastructure.Image
_imageCache.Usage = LoadStorageToConcurrentDictionary();
foreach (var icon in new[] { Constant.DefaultIcon, Constant.ErrorIcon })
foreach (var icon in new[] { Constant.DefaultIcon, Constant.MissingImgIcon })
{
ImageSource img = new BitmapImage(new Uri(icon));
img.Freeze();
@ -106,7 +106,7 @@ namespace Flow.Launcher.Infrastructure.Image
{
if (string.IsNullOrEmpty(path))
{
return new ImageResult(_imageCache[Constant.ErrorIcon], ImageType.Error);
return new ImageResult(_imageCache[Constant.MissingImgIcon], ImageType.Error);
}
if (_imageCache.ContainsKey(path))
{
@ -139,7 +139,7 @@ namespace Flow.Launcher.Infrastructure.Image
Log.Exception($"|ImageLoader.Load|Failed to get thumbnail for {path} on first try", e);
Log.Exception($"|ImageLoader.Load|Failed to get thumbnail for {path} on second try", e2);
ImageSource image = _imageCache[Constant.ErrorIcon];
ImageSource image = _imageCache[Constant.MissingImgIcon];
_imageCache[path] = image;
imageResult = new ImageResult(image, ImageType.Error);
}
@ -191,8 +191,8 @@ namespace Flow.Launcher.Infrastructure.Image
}
else
{
image = _imageCache[Constant.ErrorIcon];
path = Constant.ErrorIcon;
image = _imageCache[Constant.MissingImgIcon];
path = Constant.MissingImgIcon;
}
if (type != ImageType.Error)

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View file

@ -51,7 +51,7 @@ namespace Flow.Launcher.ViewModel
catch (Exception e)
{
Log.Exception($"|ResultViewModel.Image|IcoPath is empty and exception when calling Icon() for result <{Result.Title}> of plugin <{Result.PluginDirectory}>", e);
imagePath = Constant.ErrorIcon;
imagePath = Constant.MissingImgIcon;
}
}

View file

@ -536,7 +536,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
ProgramLogger.LogException($"|UWP|ImageFromPath|{path}" +
$"|Unable to get logo for {UserModelId} from {path} and" +
$" located in {Package.Location}", new FileNotFoundException());
return new BitmapImage(new Uri(Constant.ErrorIcon));
return new BitmapImage(new Uri(Constant.MissingImgIcon));
}
}
@ -586,7 +586,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
$"|Unable to convert background string {BackgroundColor} " +
$"to color for {Package.Location}", new InvalidOperationException());
return new BitmapImage(new Uri(Constant.ErrorIcon));
return new BitmapImage(new Uri(Constant.MissingImgIcon));
}
}
else