File tree Expand file tree Collapse file tree 2 files changed +36
-10
lines changed Expand file tree Collapse file tree 2 files changed +36
-10
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,15 @@ public MainViewModel(Settings settings)
99
99
} ;
100
100
_selectedResults = Results ;
101
101
102
+ Results . PropertyChanged += ( _ , args ) =>
103
+ {
104
+ switch ( args . PropertyName )
105
+ {
106
+ case nameof ( Results . SelectedItem ) :
107
+ UpdatePreview ( ) ;
108
+ break ;
109
+ }
110
+ } ;
102
111
103
112
RegisterViewUpdate ( ) ;
104
113
RegisterResultsUpdatedEvent ( ) ;
@@ -441,6 +450,7 @@ private void ShowPreview()
441
450
{
442
451
ResultAreaColumn = 1 ;
443
452
PreviewVisible = true ;
453
+ Results . SelectedItem ? . LoadPreviewImage ( ) ;
444
454
}
445
455
446
456
private void HidePreview ( )
@@ -461,6 +471,14 @@ public void ResetPreview()
461
471
}
462
472
}
463
473
474
+ private void UpdatePreview ( )
475
+ {
476
+ if ( PreviewVisible )
477
+ {
478
+ Results . SelectedItem ? . LoadPreviewImage ( ) ;
479
+ }
480
+ }
481
+
464
482
/// <summary>
465
483
/// we need move cursor to end when we manually changed query
466
484
/// but we don't want to move cursor to end when query is updated from TextBox
Original file line number Diff line number Diff line change @@ -90,6 +90,14 @@ public Visibility ShowIcon
90
90
}
91
91
}
92
92
93
+ public bool UsePreviewImage
94
+ {
95
+ //todo binding
96
+ get => ! ImgIconAvailable && ! GlyphAvailable ||
97
+ Settings . UseGlyphIcons && ! GlyphAvailable && ImgIconAvailable ||
98
+ ! Settings . UseGlyphIcons && ImgIconAvailable ;
99
+ }
100
+
93
101
public double IconRadius
94
102
{
95
103
get
@@ -153,16 +161,7 @@ public ImageSource Image
153
161
154
162
public ImageSource PreviewImage
155
163
{
156
- get
157
- {
158
- if ( ! PreviewImageLoaded )
159
- {
160
- PreviewImageLoaded = true ;
161
- _ = LoadPreviewImageAsync ( ) ;
162
- }
163
-
164
- return previewImage ;
165
- }
164
+ get => previewImage ;
166
165
private set => previewImage = value ;
167
166
}
168
167
@@ -223,6 +222,15 @@ private async Task LoadPreviewImageAsync()
223
222
}
224
223
}
225
224
225
+ public void LoadPreviewImage ( )
226
+ {
227
+ if ( ! PreviewImageLoaded && UsePreviewImage )
228
+ {
229
+ PreviewImageLoaded = true ;
230
+ _ = LoadPreviewImageAsync ( ) ;
231
+ }
232
+ }
233
+
226
234
public Result Result { get ; }
227
235
public int ResultProgress
228
236
{
You can’t perform that action at this time.
0 commit comments