Exemplo n.º 1
0
        /// <summary>
        /// For more information, see:
        /// http://www.w3.org/html/wg/drafts/html/master/embedded-content.html#update-the-image-data
        /// </summary>
        void GetImage(Url source)
        {
            if (source.IsInvalid)
                source = null;
            else if (_img != null && source.Equals(_img.Source))
                return;

            this.CancelTasks();

            if (source == null)
                return;

            var request = this.CreateRequestFor(source);
            this.LoadResource<IImageInfo>(request).
                 ContinueWith(FinishLoading);
        }
Exemplo n.º 2
0
        /// <summary>
        /// For more information, see:
        /// http://www.w3.org/html/wg/drafts/html/master/embedded-content.html#update-the-image-data
        /// </summary>
        void GetImage(Url source)
        {
            if (source.IsInvalid)
            {
                source = null;
            }
            else if (_img != null && source.Equals(_img.Source))
            {
                return;
            }

            if (_download != null && !_download.IsCompleted)
            {
                _download.Cancel();
            }

            var document = Owner;

            if (source != null && document != null)
            {
                var loader = document.Loader;

                if (loader != null)
                {
                    var request = this.CreateRequestFor(source);
                    var download = loader.DownloadAsync(request);
                    var task = this.ProcessResource<IImageInfo>(download, result => _img = result);
                    document.DelayLoad(task);
                    _download = download;
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// For more information, see:
        /// http://www.w3.org/html/wg/drafts/html/master/embedded-content.html#update-the-image-data
        /// </summary>
        void GetImage(Url source)
        {
            if (source.IsInvalid)
                source = null;
            else if (_lastSource != null && source.Equals(_lastSource))
                return;

            this.CancelTasks();
            _lastSource = source;

            if (source == null)
                return;

            var request = this.CreateRequestFor(source);
            this.LoadResource<IImageInfo>(request).ContinueWith(m =>
            {
                if (m.IsFaulted == false)
                    _img = m.Result;

                this.FireLoadOrErrorEvent(m);
            });
        }
Exemplo n.º 4
0
 protected Boolean IsDifferentToCurrentDownloadUrl(Url target)
 {
     var download = Download;
     return download == null || !target.Equals(download.Target);
 }