@@ -138,17 +138,7 @@ private async Task LoadImageAsync(Uri imageUri)
138
138
{
139
139
if ( IsCacheEnabled )
140
140
{
141
- switch ( CachingStrategy )
142
- {
143
- case ImageExCachingStrategy . Custom when _isHttpSource :
144
- await SetHttpSourceCustomCached ( imageUri ) ;
145
- break ;
146
- case ImageExCachingStrategy . Custom :
147
- case ImageExCachingStrategy . Internal :
148
- default :
149
- AttachSource ( new BitmapImage ( imageUri ) ) ;
150
- break ;
151
- }
141
+ AttachSource ( new BitmapImage ( imageUri ) ) ;
152
142
}
153
143
else if ( string . Equals ( _uri . Scheme , "data" , StringComparison . OrdinalIgnoreCase ) )
154
144
{
@@ -172,57 +162,5 @@ private async Task LoadImageAsync(Uri imageUri)
172
162
}
173
163
}
174
164
}
175
-
176
- private async Task SetHttpSourceCustomCached ( Uri imageUri )
177
- {
178
- try
179
- {
180
- var propValues = new List < KeyValuePair < string , object > > ( ) ;
181
-
182
- if ( DecodePixelHeight > 0 )
183
- {
184
- propValues . Add ( new KeyValuePair < string , object > ( nameof ( DecodePixelHeight ) , DecodePixelHeight ) ) ;
185
- }
186
-
187
- if ( DecodePixelWidth > 0 )
188
- {
189
- propValues . Add ( new KeyValuePair < string , object > ( nameof ( DecodePixelWidth ) , DecodePixelWidth ) ) ;
190
- }
191
-
192
- if ( propValues . Count > 0 )
193
- {
194
- propValues . Add ( new KeyValuePair < string , object > ( nameof ( DecodePixelType ) , DecodePixelType ) ) ;
195
- }
196
-
197
- var img = await ImageCache . Instance . GetFromCacheAsync ( imageUri , true , _tokenSource . Token , propValues ) ;
198
-
199
- lock ( LockObj )
200
- {
201
- // If you have many imageEx in a virtualized ListView for instance
202
- // controls will be recycled and the uri will change while waiting for the previous one to load
203
- if ( _uri == imageUri )
204
- {
205
- AttachSource ( img ) ;
206
- ImageExOpened ? . Invoke ( this , new ImageExOpenedEventArgs ( ) ) ;
207
- VisualStateManager . GoToState ( this , LoadedState , true ) ;
208
- }
209
- }
210
- }
211
- catch ( OperationCanceledException )
212
- {
213
- // nothing to do as cancellation has been requested.
214
- }
215
- catch ( Exception e )
216
- {
217
- lock ( LockObj )
218
- {
219
- if ( _uri == imageUri )
220
- {
221
- ImageExFailed ? . Invoke ( this , new ImageExFailedEventArgs ( e ) ) ;
222
- VisualStateManager . GoToState ( this , FailedState , true ) ;
223
- }
224
- }
225
- }
226
- }
227
165
}
228
166
}
0 commit comments