@@ -18,30 +18,28 @@ public class GifImage : Control
1818 string
1919 > ( "SourceUriRaw" ) ;
2020
21- public static readonly StyledProperty < Uri > SourceUriProperty = AvaloniaProperty . Register < GifImage , Uri > (
22- "SourceUri"
23- ) ;
21+ public static readonly StyledProperty < Uri > SourceUriProperty = AvaloniaProperty . Register <
22+ GifImage ,
23+ Uri
24+ > ( "SourceUri" ) ;
2425
2526 public static readonly StyledProperty < Stream > SourceStreamProperty = AvaloniaProperty . Register <
2627 GifImage ,
2728 Stream
2829 > ( "SourceStream" ) ;
2930
30- public static readonly StyledProperty < IterationCount > IterationCountProperty = AvaloniaProperty . Register <
31- GifImage ,
32- IterationCount
33- > ( "IterationCount" , IterationCount . Infinite ) ;
31+ public static readonly StyledProperty < IterationCount > IterationCountProperty =
32+ AvaloniaProperty . Register < GifImage , IterationCount > ( "IterationCount" , IterationCount . Infinite ) ;
3433
3534 private IGifInstance ? _gifInstance ;
3635
37- public static readonly StyledProperty < StretchDirection > StretchDirectionProperty = AvaloniaProperty . Register <
38- GifImage ,
39- StretchDirection
40- > ( "StretchDirection" ) ;
36+ public static readonly StyledProperty < StretchDirection > StretchDirectionProperty =
37+ AvaloniaProperty . Register < GifImage , StretchDirection > ( "StretchDirection" ) ;
4138
42- public static readonly StyledProperty < Stretch > StretchProperty = AvaloniaProperty . Register < GifImage , Stretch > (
43- "Stretch"
44- ) ;
39+ public static readonly StyledProperty < Stretch > StretchProperty = AvaloniaProperty . Register <
40+ GifImage ,
41+ Stretch
42+ > ( "Stretch" ) ;
4543
4644 private CompositionCustomVisual ? _customVisual ;
4745
@@ -288,10 +286,19 @@ e.NewValue is null
288286 private void UpdateGifInstance ( object source )
289287 {
290288 _gifInstance ? . Dispose ( ) ;
291- _gifInstance = new WebpInstance ( source ) ;
292- // _gifInstance = new GifInstance(source);
293- _gifInstance . IterationCount = IterationCount ;
294- _customVisual ? . SendHandlerMessage ( _gifInstance ) ;
289+
290+ try
291+ {
292+ _gifInstance = new WebpInstance ( source ) ;
293+ // _gifInstance = new GifInstance(source);
294+
295+ _gifInstance . IterationCount = IterationCount ;
296+ _customVisual ? . SendHandlerMessage ( _gifInstance ) ;
297+ }
298+ catch ( Exception e )
299+ {
300+ Logger . Sink ? . Log ( LogEventLevel . Warning , "GifImage Update Source " , this , e . ToString ( ) ) ;
301+ }
295302 }
296303 }
297304}
0 commit comments