Skip to content

Commit e5f2e8d

Browse files
authored
Merge pull request #105 from jvyden/linux-icon-fix
Load PNG as fallback if ico fails
2 parents c8c09ef + 932b622 commit e5f2e8d

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

Refresher/Refresher.csproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@
5050
<PackageReference Condition="!$(IsWindows) And !$(IsOSX)" Include="Eto.Platform.Gtk" Version="2.9.0" />
5151
<PackageReference Condition="$(IsOSX)" Include="Eto.Platform.Mac64" Version="2.9.0" />
5252
<PackageReference Condition="$(IsWindows)" Include="Eto.Platform.Wpf" Version="2.9.0" />
53-
<EmbeddedResource Include="Resources\refresher.ico" LogicalName="refresher.ico" />
5453
<PackageReference Include="Sentry" Version="4.4.0" />
55-
<Content Include="Resources/refresher.icns" Link="refresher.icns" Condition="$(IsOSX)" />
5654
<PackageReference Include="Velopack" Version="0.0.1298" />
5755
</ItemGroup>
56+
57+
<ItemGroup>
58+
<EmbeddedResource Include="Resources\refresher.ico" LogicalName="refresher.ico" />
59+
<EmbeddedResource Include="Resources\refresher.png" LogicalName="refresher.png" />
60+
<Content Include="Resources/refresher.icns" Link="refresher.icns" Condition="$(IsOSX)" />
61+
</ItemGroup>
5862

5963
<ItemGroup>
6064
<ProjectReference Include="..\Refresher.Core\Refresher.Core.csproj" />

Refresher/Resources/refresher.png

68.5 KB
Loading

Refresher/UI/RefresherForm.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,20 @@ protected RefresherForm(string subtitle, Size size, bool padBottom = true)
2222
{
2323
this.Icon = Icon.FromResource("refresher.ico");
2424
}
25-
catch (Exception ex)
25+
catch(Exception ex)
2626
{
27-
// Not very important, so this should just be a warning, not an error
27+
// Not very important, so these should just be warnings, not errors
2828
State.Logger.LogWarning(LogType.RefresherForm, $"Unhandled exception while loading refresher.ico in {this.GetType()}: {ex}");
29+
30+
// attempt to fall back to png icon
31+
try
32+
{
33+
this.Icon = Icon.FromResource("refresher.png");
34+
}
35+
catch (Exception ex2)
36+
{
37+
State.Logger.LogWarning(LogType.RefresherForm, $"Unhandled exception while loading refresher.png in {this.GetType()}: {ex2}");
38+
}
2939
}
3040

3141
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))

0 commit comments

Comments
 (0)