Embed branding assets in app assembly
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
Background="{DynamicResource AppSurfaceBrush}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top">
|
||||
<Image Source="Assets/AboutLogo.png"
|
||||
<Image Source="pack://application:,,,/Assets/AboutLogo.png"
|
||||
Width="74"
|
||||
Height="74"
|
||||
Stretch="UniformToFill"/>
|
||||
|
||||
@@ -106,8 +106,22 @@ public sealed class LauncherController : IDisposable
|
||||
|
||||
private static Icon LoadTrayIcon()
|
||||
{
|
||||
string iconPath = Path.Combine(AppContext.BaseDirectory, "Assets", "TrayIcon.ico");
|
||||
return File.Exists(iconPath) ? new Icon(iconPath) : SystemIcons.Application;
|
||||
try
|
||||
{
|
||||
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)
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\AboutLogo.png" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Include="Assets\TrayIcon.ico" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Resource Include="Assets\AboutLogo.png" />
|
||||
<Resource Include="Assets\TrayIcon.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user