mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 20:57:22 +02:00
fix js based application logo #198
This commit is contained in:
@@ -81,6 +81,7 @@ namespace Wox.Plugin.Program.Programs
|
|||||||
{
|
{
|
||||||
Apps[i].UserModelId = currentApp.GetAppUserModelId();
|
Apps[i].UserModelId = currentApp.GetAppUserModelId();
|
||||||
Apps[i].BackgroundColor = currentApp.GetStringValue("BackgroundColor") ?? string.Empty;
|
Apps[i].BackgroundColor = currentApp.GetStringValue("BackgroundColor") ?? string.Empty;
|
||||||
|
// todo use hidpi logo when use hidpi screen
|
||||||
Apps[i].LogoPath = Path.Combine(Location, currentApp.GetStringValue("Square44x44Logo"));
|
Apps[i].LogoPath = Path.Combine(Location, currentApp.GetStringValue("Square44x44Logo"));
|
||||||
Apps[i].Location = Location;
|
Apps[i].Location = Location;
|
||||||
}
|
}
|
||||||
@@ -280,7 +281,6 @@ namespace Wox.Plugin.Program.Programs
|
|||||||
public ImageSource Logo()
|
public ImageSource Logo()
|
||||||
{
|
{
|
||||||
var logo = !string.IsNullOrEmpty(LogoPath) ? ImageFromPath(LogoPath) : ImageFromStream(LogoStream);
|
var logo = !string.IsNullOrEmpty(LogoPath) ? ImageFromPath(LogoPath) : ImageFromStream(LogoStream);
|
||||||
|
|
||||||
var validBaground = !string.IsNullOrEmpty(BackgroundColor) && BackgroundColor != "transparent";
|
var validBaground = !string.IsNullOrEmpty(BackgroundColor) && BackgroundColor != "transparent";
|
||||||
var plated = validBaground ? PlatedImage(logo) : logo;
|
var plated = validBaground ? PlatedImage(logo) : logo;
|
||||||
|
|
||||||
@@ -290,6 +290,8 @@ namespace Wox.Plugin.Program.Programs
|
|||||||
}
|
}
|
||||||
|
|
||||||
private BitmapImage ImageFromPath(string path)
|
private BitmapImage ImageFromPath(string path)
|
||||||
|
{
|
||||||
|
if (!File.Exists(path))
|
||||||
{
|
{
|
||||||
// https://msdn.microsoft.com/windows/uwp/controls-and-patterns/tiles-and-notifications-app-assets
|
// https://msdn.microsoft.com/windows/uwp/controls-and-patterns/tiles-and-notifications-app-assets
|
||||||
var extension = path.Substring(path.Length - 4);
|
var extension = path.Substring(path.Length - 4);
|
||||||
@@ -312,6 +314,13 @@ namespace Wox.Plugin.Program.Programs
|
|||||||
return new BitmapImage(new Uri(Constant.ErrorIcon));
|
return new BitmapImage(new Uri(Constant.ErrorIcon));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// for js based application, e.g cut the rope
|
||||||
|
var image = new BitmapImage(new Uri(path));
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private BitmapImage ImageFromStream(RandomAccessStreamReference reference)
|
private BitmapImage ImageFromStream(RandomAccessStreamReference reference)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user