コード例 #1
0
 private static void SetAnimator(DependencyObject obj, Animator value)
 {
     obj.SetValue(AnimatorProperty, value);
 }
コード例 #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();
 }
コード例 #3
0
 private void SetAnimatorCore(Animator animator)
 {
     _animator = animator;
     _image.Source = animator.Bitmap;
     if (_autoStart)
         animator.Play();
     else
         animator.ShowFirstFrame();
 }
コード例 #4
0
        public void ClearAnimatorCore()
        {
            if (_animator == null)
                return;

            _animator.Dispose();
            _animator = null;
        }
コード例 #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);
            }
        }
コード例 #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);
     }
 }
コード例 #7
0
 private static void SetAnimatorCore(Image image, Animator animator)
 {
     SetAnimator(image, animator);
     image.Source = animator.Bitmap;
     if (GetAutoStart(image))
         animator.Play();
     else
         animator.ShowFirstFrame();
 }
コード例 #8
0
 private static void SetAnimatorCore(Image image, Animator animator)
 {
     SetAnimator(image, animator);
     image.Source = animator.Bitmap;
     if (GetAutoStart(image))
         animator.Play();
     else
         animator.CurrentFrameIndex = 0;
 }
コード例 #9
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;
            }
        }