This commit is contained in:
Robert McRackan 2023-02-06 08:35:24 -05:00
parent 85769d797b
commit 39fe7b79d2
4 changed files with 22 additions and 14 deletions

View File

@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<Version>9.2.1.1</Version> <Version>9.2.2.1</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Octokit" Version="5.0.0" /> <PackageReference Include="Octokit" Version="5.0.0" />

View File

@ -130,8 +130,17 @@ namespace LibationAvalonia.ViewModels
} }
private void PictureStorage_PictureCached(object sender, PictureCachedEventArgs e) private void PictureStorage_PictureCached(object sender, PictureCachedEventArgs e)
{ {
if (e.Definition.PictureId == Book.PictureId) // state validation
if (e is null ||
e.Definition.PictureId is null ||
Book?.PictureId is null ||
e.Picture is null ||
e.Picture.Length == 0)
return;
// logic validation
if (e.Definition.PictureId == Book.PictureId)
{ {
using var ms = new System.IO.MemoryStream(e.Picture); using var ms = new System.IO.MemoryStream(e.Picture);
Cover = new Avalonia.Media.Imaging.Bitmap(ms); Cover = new Avalonia.Media.Imaging.Bitmap(ms);

View File

@ -140,7 +140,16 @@ namespace LibationWinForms.GridView
private void PictureStorage_PictureCached(object sender, PictureCachedEventArgs e) private void PictureStorage_PictureCached(object sender, PictureCachedEventArgs e)
{ {
if (e.Definition.PictureId == Book.PictureId) // state validation
if (e is null ||
e.Definition.PictureId is null ||
Book?.PictureId is null ||
e.Picture is null ||
e.Picture.Length == 0)
return;
// logic validation
if (e.Definition.PictureId == Book.PictureId)
{ {
Cover = ImageReader.ToImage(e.Picture); Cover = ImageReader.ToImage(e.Picture);
PictureStorage.PictureCached -= PictureStorage_PictureCached; PictureStorage.PictureCached -= PictureStorage_PictureCached;

View File

@ -64,16 +64,6 @@
<DependentUpon>SettingsDialog.cs</DependentUpon> <DependentUpon>SettingsDialog.cs</DependentUpon>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Compile Update="Form1.*.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Update="Form1.*.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Properties\Resources.Designer.cs"> <Compile Update="Properties\Resources.Designer.cs">