Embed branding assets in app assembly
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
Background="{DynamicResource AppSurfaceBrush}"
|
Background="{DynamicResource AppSurfaceBrush}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Top">
|
VerticalAlignment="Top">
|
||||||
<Image Source="Assets/AboutLogo.png"
|
<Image Source="pack://application:,,,/Assets/AboutLogo.png"
|
||||||
Width="74"
|
Width="74"
|
||||||
Height="74"
|
Height="74"
|
||||||
Stretch="UniformToFill"/>
|
Stretch="UniformToFill"/>
|
||||||
|
|||||||
@@ -106,8 +106,22 @@ public sealed class LauncherController : IDisposable
|
|||||||
|
|
||||||
private static Icon LoadTrayIcon()
|
private static Icon LoadTrayIcon()
|
||||||
{
|
{
|
||||||
string iconPath = Path.Combine(AppContext.BaseDirectory, "Assets", "TrayIcon.ico");
|
try
|
||||||
return File.Exists(iconPath) ? new Icon(iconPath) : SystemIcons.Application;
|
{
|
||||||
|
Uri iconUri = new("pack://application:,,,/Assets/TrayIcon.ico", UriKind.Absolute);
|
||||||
|
System.Windows.Resources.StreamResourceInfo? resource = System.Windows.Application.GetResourceStream(iconUri);
|
||||||
|
if (resource?.Stream is null)
|
||||||
|
{
|
||||||
|
return SystemIcons.Application;
|
||||||
|
}
|
||||||
|
|
||||||
|
using Icon icon = new(resource.Stream);
|
||||||
|
return (Icon)icon.Clone();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return SystemIcons.Application;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LaunchItem(LauncherItem item)
|
private void LaunchItem(LauncherItem item)
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Assets\AboutLogo.png" CopyToOutputDirectory="PreserveNewest" />
|
<Resource Include="Assets\AboutLogo.png" />
|
||||||
<Content Include="Assets\TrayIcon.ico" CopyToOutputDirectory="PreserveNewest" />
|
<Resource Include="Assets\TrayIcon.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user