CheckDesignMode() private static method

private static CheckDesignMode ( Image image, Uri sourceUri, Stream sourceStream ) : bool
image Image
sourceUri System.Uri
sourceStream Stream
return bool
Beispiel #1
0
        private static async void InitAnimationAsync(Image image, Stream stream, RepeatBehavior repeatBehavior, int seqNum)
        {
            if (!AnimationBehavior.CheckDesignMode(image, null, stream))
            {
                return;
            }
            try
            {
                Animator async = await Animator.CreateAsync(image, stream, repeatBehavior);

                AnimationBehavior.SetAnimatorCore(image, async);
                if (AnimationBehavior.GetSeqNum((DependencyObject)image) != seqNum)
                {
                    async.Dispose();
                }
                else
                {
                    AnimationBehavior.OnLoaded(image);
                }
            }
            catch (Exception ex)
            {
                AnimationBehavior.OnError(image, ex, AnimationErrorKind.Loading);
            }
        }
Beispiel #2
0
        private static async void InitAnimationAsync(Image image, Uri sourceUri, CancellationToken cancellationToken, RepeatBehavior repeatBehavior, int seqNum)
        {
            if (!AnimationBehavior.CheckDesignMode(image, sourceUri, null))
            {
                return;
            }
            try
            {
                // ISSUE: reference to a compiler-generated field
                Animator.DownloadProgressChanged += AnimationBehavior.DownloadProgressChanged;
                Animator async = await Animator.CreateAsync(image, sourceUri, cancellationToken, repeatBehavior);

                // ISSUE: reference to a compiler-generated field
                Animator.DownloadProgressChanged -= AnimationBehavior.DownloadProgressChanged;
                if (async == null || AnimationBehavior.GetSeqNum((DependencyObject)image) != seqNum)
                {
                    if (async == null)
                    {
                        return;
                    }
                    // ISSUE: explicit non-virtual call
                    async.Dispose();
                }
                else
                {
                    AnimationBehavior.SetAnimatorCore(image, async);
                    AnimationBehavior.OnLoaded(image);
                }
            }
            catch (Exception ex)
            {
                // ISSUE: reference to a compiler-generated field
                Animator.DownloadProgressChanged -= AnimationBehavior.DownloadProgressChanged;
                AnimationBehavior.OnError(image, ex, AnimationErrorKind.Loading);
            }
        }