mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-14 20:29:07 +00:00
Refactor DependencyProperty registration
This commit is contained in:
@@ -59,21 +59,19 @@ public class AnimatedImage : Image, IDisposable
|
|||||||
return provider;
|
return provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region DependencyProperty
|
|
||||||
|
|
||||||
public static readonly DependencyProperty AnimationFrameIndexProperty =
|
public static readonly DependencyProperty AnimationFrameIndexProperty =
|
||||||
DependencyProperty.Register("AnimationFrameIndex", typeof(int), typeof(AnimatedImage),
|
DependencyProperty.Register(nameof(AnimationFrameIndex), typeof(int), typeof(AnimatedImage),
|
||||||
new UIPropertyMetadata(-1, AnimationFrameIndexChanged));
|
new UIPropertyMetadata(-1, AnimationFrameIndexChanged));
|
||||||
|
|
||||||
public static readonly DependencyProperty AnimationUriProperty =
|
public static readonly DependencyProperty AnimationUriProperty =
|
||||||
DependencyProperty.Register("AnimationUri", typeof(Uri), typeof(AnimatedImage),
|
DependencyProperty.Register(nameof(AnimationUri), typeof(Uri), typeof(AnimatedImage),
|
||||||
new UIPropertyMetadata(null, AnimationUriChanged));
|
new UIPropertyMetadata(null, AnimationUriChanged));
|
||||||
|
|
||||||
public static readonly DependencyProperty MetaProperty =
|
public static readonly DependencyProperty MetaProperty =
|
||||||
DependencyProperty.Register("Meta", typeof(MetaProvider), typeof(AnimatedImage));
|
DependencyProperty.Register(nameof(Meta), typeof(MetaProvider), typeof(AnimatedImage));
|
||||||
|
|
||||||
public static readonly DependencyProperty ContextObjectProperty =
|
public static readonly DependencyProperty ContextObjectProperty =
|
||||||
DependencyProperty.Register("ContextObject", typeof(ContextObject), typeof(AnimatedImage));
|
DependencyProperty.Register(nameof(ContextObject), typeof(ContextObject), typeof(AnimatedImage));
|
||||||
|
|
||||||
public int AnimationFrameIndex
|
public int AnimationFrameIndex
|
||||||
{
|
{
|
||||||
@@ -104,9 +102,6 @@ public class AnimatedImage : Image, IDisposable
|
|||||||
if (obj is not AnimatedImage instance)
|
if (obj is not AnimatedImage instance)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//var thumbnail = instance.Meta?.GetThumbnail(true);
|
|
||||||
//instance.Source = thumbnail;
|
|
||||||
|
|
||||||
instance._animation = InitAnimationProvider((Uri)ev.NewValue, instance.Meta, instance.ContextObject);
|
instance._animation = InitAnimationProvider((Uri)ev.NewValue, instance.Meta, instance.ContextObject);
|
||||||
ShowThumbnailAndStartAnimation(instance);
|
ShowThumbnailAndStartAnimation(instance);
|
||||||
}
|
}
|
||||||
@@ -161,6 +156,4 @@ public class AnimatedImage : Image, IDisposable
|
|||||||
}));
|
}));
|
||||||
task.Start();
|
task.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion DependencyProperty
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user