Skip to content

Commit 2c14c21

Browse files
bao-qiantaooceros
authored andcommitted
Lazy Load Image
1 parent 69a5f29 commit 2c14c21

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Flow.Launcher/ResultListBox.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<ColumnDefinition Width="0" />
4343
</Grid.ColumnDefinitions>
4444
<Image x:Name="ImageIcon" Width="32" Height="32" HorizontalAlignment="Left"
45-
Source="{Binding Image ,IsAsync=True}" />
45+
Source="{Binding Image.Value}" />
4646
<Grid Margin="5 0 5 0" Grid.Column="1" HorizontalAlignment="Stretch">
4747
<Grid.RowDefinitions>
4848
<RowDefinition />

Flow.Launcher/ViewModel/ResultViewModel.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public ResultViewModel(Result result, Settings settings)
1818
if (result != null)
1919
{
2020
Result = result;
21+
Image = new Lazy<ImageSource>(() => SetImage);
2122
}
2223

2324
Settings = settings;
@@ -36,8 +37,10 @@ public ResultViewModel(Result result, Settings settings)
3637
public string ShowSubTitleToolTip => string.IsNullOrEmpty(Result.SubTitleToolTip)
3738
? Result.SubTitle
3839
: Result.SubTitleToolTip;
40+
41+
public Lazy<ImageSource> Image { get; set; }
3942

40-
public ImageSource Image
43+
private ImageSource SetImage
4144
{
4245
get
4346
{
@@ -75,6 +78,7 @@ public override bool Equals(object obj)
7578
}
7679
}
7780

81+
7882
public override int GetHashCode()
7983
{
8084
return Result.GetHashCode();

0 commit comments

Comments
 (0)