ClearAnimatorCore() private static method

private static ClearAnimatorCore ( Image image ) : void
image Image
return void
Beispiel #1
0
        private static void Image_Unloaded(object sender, RoutedEventArgs e)
        {
            Image image = (Image)sender;
            // ISSUE: method pointer
            RoutedEventHandler routedEventHandler1 = new RoutedEventHandler(AnimationBehavior.Image_Unloaded);

            ((FrameworkElement)image).Unloaded -= (routedEventHandler1);
            // ISSUE: method pointer
            RoutedEventHandler routedEventHandler2 = new RoutedEventHandler(AnimationBehavior.Image_Loaded);

            ((FrameworkElement)image).Loaded += (routedEventHandler2);
            AnimationBehavior.ClearAnimatorCore(image);
        }
Beispiel #2
0
 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));
     }
 }