コード例 #1
0
        /// <summary>
        /// Loads the image into given Image using defined parameters.
        /// </summary>
        /// <param name="parameters">Parameters for loading the image.</param>
        /// <param name="imageView">Image view that should receive the image.</param>
        public static IScheduledWork Into(this TaskParameter parameters, Image imageView)
        {
            var target = new ImageTarget(imageView);

            if (parameters.Source != Work.ImageSource.Stream && string.IsNullOrWhiteSpace(parameters.Path))
            {
                target.SetAsEmpty(null);
                parameters.TryDispose();
                return(null);
            }

            var task = ImageService.CreateTask(parameters, target);

            ImageService.Instance.LoadImage(task);
            return(task);
        }