private static InitAnimationAsync ( Image image, Stream stream, RepeatBehavior repeatBehavior, int seqNum ) : void | ||
image | Image | |
stream | Stream | |
repeatBehavior | RepeatBehavior | |
seqNum | int | |
Résultat | void |
private static void InitAnimation(Image image) { if (AnimationBehavior.IsLoaded((FrameworkElement)image)) { // ISSUE: method pointer ((FrameworkElement)image).Unloaded += (new RoutedEventHandler(AnimationBehavior.Image_Unloaded)); if (AnimationBehavior._cancellationTokenSource != null) { AnimationBehavior._cancellationTokenSource.Cancel(); AnimationBehavior._cancellationTokenSource.Dispose(); AnimationBehavior._cancellationTokenSource = null; } AnimationBehavior._cancellationTokenSource = new CancellationTokenSource(); int seqNum = AnimationBehavior.GetSeqNum((DependencyObject)image) + 1; AnimationBehavior.SetSeqNum((DependencyObject)image, seqNum); image.Source = (null); AnimationBehavior.ClearAnimatorCore(image); try { Stream sourceStream = AnimationBehavior.GetSourceStream((DependencyObject)image); if (sourceStream != null) { AnimationBehavior.InitAnimationAsync(image, sourceStream, AnimationBehavior.GetRepeatBehavior((DependencyObject)image), seqNum); } else { Uri absoluteUri = AnimationBehavior.GetAbsoluteUri(image); if (!(absoluteUri != null)) { return; } AnimationBehavior.InitAnimationAsync(image, absoluteUri, AnimationBehavior._cancellationTokenSource.Token, AnimationBehavior.GetRepeatBehavior((DependencyObject)image), seqNum); } } catch (Exception ex) { AnimationBehavior.OnError(image, ex, AnimationErrorKind.Loading); } } else { // ISSUE: method pointer ((FrameworkElement)image).Loaded += (new RoutedEventHandler(AnimationBehavior.Image_Loaded)); } }