Skip to content

Commit be08476

Browse files
author
Juan Segura
committed
Changed the location and loading system of tool icons to avoid bugs on Mac.
1 parent efd3720 commit be08476

7 files changed

Lines changed: 17 additions & 19 deletions

File tree

ZXBSInstaller.Log/ZXBSInstaller.Log.csproj

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,4 @@
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88

9-
<ItemGroup>
10-
<None Remove="InstallerResources\zxbs.png" />
11-
</ItemGroup>
12-
13-
<ItemGroup>
14-
<Content Include="InstallerResources\zxbasic.png">
15-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
16-
</Content>
17-
<Content Include="InstallerResources\zxbsinstaller.png">
18-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
19-
</Content>
20-
<Content Include="InstallerResources\zxbs.png">
21-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
22-
</Content>
23-
</ItemGroup>
24-
259
</Project>

ZXBSInstaller/Controls/ToolItemControl.axaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public ToolItemControl(ExternalTool tool, Action<string, string> callBackCommand
2525
ExternalTool = tool;
2626
Command = callBackCommand;
2727

28-
UITools.ShowImage($"InstallerResources/{ExternalTool.Id}.png", imgIcon);
28+
UITools.ShowImage($"{ExternalTool.Id}.png", imgIcon);
2929
txtName.Text = tool.Name;
3030
txtDescription.Text = tool.Description;
3131
txtPath.Text = "Path: " + tool.LocalPath;
File renamed without changes.
File renamed without changes.
File renamed without changes.

ZXBSInstaller/UITools.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Avalonia.Controls;
22
using Avalonia.Media.Imaging;
3+
using Avalonia.Platform;
34
using System;
45
using System.Collections.Generic;
56
using System.IO;
@@ -15,8 +16,12 @@ public static void ShowImage(string fileName, Image imgControl)
1516
{
1617
try
1718
{
18-
using var stream = File.OpenRead(fileName);
19-
imgControl.Source = new Bitmap(stream);
19+
//using var stream = File.OpenRead(fileName);
20+
//imgControl.Source = new Bitmap(stream);
21+
var uri= new Uri($"avares://ZXBSInstaller/Resources/{fileName}");
22+
var asset=AssetLoader.Open(uri);
23+
var bitmap=new Bitmap(asset);
24+
imgControl.Source = bitmap;
2025
}
2126
catch (Exception ex)
2227
{

ZXBSInstaller/ZXBSInstaller.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
<AvaloniaResource Include="zxbs.ico" />
1313
</ItemGroup>
1414
<ItemGroup>
15+
<AvaloniaResource Include="Resources\zxbasic.png">
16+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
17+
</AvaloniaResource>
18+
<AvaloniaResource Include="Resources\zxbs.png">
19+
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
20+
</AvaloniaResource>
21+
<AvaloniaResource Include="Resources\zxbsinstaller.png">
22+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
23+
</AvaloniaResource>
1524
<Content Include="zxbs.ico" />
1625
</ItemGroup>
1726

0 commit comments

Comments
 (0)