Esempio n. 1
0
 private static void SetAnimator(DependencyObject obj, Animator value)
 {
     obj.SetValue(AnimatorProperty, value);
 }
Esempio n. 2
0
 private static async Task SetAnimatorCoreAsync(Image image, Animator animator)
 {
     SetAnimator(image, animator);
     animator.Error += AnimatorError;
     image.Source = animator.Bitmap;
     if (GetAutoStart(image))
         animator.Play();
     else
         await animator.ShowFirstFrameAsync();
 }
Esempio n. 3
0
 private void SetAnimatorCore(Animator animator)
 {
     _animator = animator;
     _image.Source = animator.Bitmap;
     if (_autoStart)
         animator.Play();
     else
         animator.ShowFirstFrame();
 }
Esempio n. 4
0
        public void ClearAnimatorCore()
        {
            if (_animator == null)
                return;

            _animator.Dispose();
            _animator = null;
        }
Esempio n. 5
0
        private async void InitStreamAnimationAsync()
        {
            try
            {
                _animator = await Animator.CreateAsync(_image, _sourceStream, _repeatBehavior);
                SetAnimatorCore(_animator);
                OnLoaded(_image);
            }
            catch (InvalidSignatureException)
            {
                var bmp = new BitmapImage();
#if WPF
                bmp.BeginInit();
                bmp.StreamSource = stream;
                bmp.EndInit();
#elif WINRT
                bmp.SetSource(_sourceStream.AsRandomAccessStream());
#endif
                _image.Source = bmp;
                OnLoaded(_image);
            }
            catch(Exception ex)
            {
                OnError(_image, ex, AnimationErrorKind.Loading);
            }
        }
Esempio n. 6
0
 private async void InitUriAnimationAsync()
 {
     try
     {
         _animator = await Animator.CreateAsync(_image, _sourceUri, _repeatBehavior,Progress);
         SetAnimatorCore(_animator);
         OnLoaded(_image);
     }
     catch (InvalidSignatureException)
     {
         _image.Source = new BitmapImage(_sourceUri);
         OnLoaded(_image);
     }
     catch(Exception ex)
     {
         OnError(_image, ex, AnimationErrorKind.Loading);
     }
 }
 private static void SetAnimatorCore(Image image, Animator animator)
 {
     SetAnimator(image, animator);
     image.Source = animator.Bitmap;
     if (GetAutoStart(image))
         animator.Play();
     else
         animator.ShowFirstFrame();
 }
 private static void SetAnimatorCore(Image image, Animator animator)
 {
     SetAnimator(image, animator);
     image.Source = animator.Bitmap;
     if (GetAutoStart(image))
         animator.Play();
     else
         animator.CurrentFrameIndex = 0;
 }
        private void backgroundImage_Loaded(object sender, RoutedEventArgs e)
        {
            if (animator != null)
            {
                animator.CurrentFrameChanged -= Animator_CurrentFrameChanged;
            }

            animator = AnimationBehavior.GetAnimator(backgroundImage);
            if (animator != null)
            {
                animator.CurrentFrameChanged += Animator_CurrentFrameChanged;
            }
        }