private static void BindSource(AnimatedGIF gif) { gif.StopAnimate(); if (gif.Bitmap != null) { gif.Bitmap.Dispose(); } var path = gif.GIFSource; if (path.IsInvalid()) { return; } if (!Path.IsPathRooted(path)) { path = File.GetPhysicalPath(path); } gif.Bitmap = new Bitmap(path); gif.BitmapSource = GetBitmapSource(gif.Bitmap, gif.BitmapSource); gif.StartAnimate(); }
private static void OnAnimatioinEnableChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { AnimatedGIF gif = sender as AnimatedGIF; if (gif == null) { return; } if (!gif.IsLoaded) { return; } if (gif.AnimatioinEnable) { gif.StartAnimate(); } else { gif.StopAnimate(); } }