Example #1
0
        /// <summary>
        /// Loads the WriteableBitmap asynchronously given the storage file and the dimensions.
        /// </summary>
        /// <param name="writeableBitmap">The writeable bitmap.</param>
        /// <param name="relativePath">The relative path.</param>
        /// <returns></returns>
        public static async Task <WriteableBitmap> LoadAsync(
            this WriteableBitmap writeableBitmap,
            string relativePath)
        {
            var resolvedFile = await ScaledImageFile.Get(relativePath);

            if (resolvedFile == null)
            {
                throw new FileNotFoundException("Could not load image.", relativePath);
            }

            return(await writeableBitmap.LoadAsync(resolvedFile));
        }
Example #2
0
        /// <summary>
        /// Loads the WriteableBitmap asynchronously given the file path relative to install location and the dimensions.
        /// </summary>
        /// <param name="writeableBitmap">The writeable bitmap.</param>
        /// <param name="relativePath">The relative path.</param>
        /// <param name="decodePixelWidth">Width in pixels of the decoded bitmap.</param>
        /// <param name="decodePixelHeight">Height in pixels of the decoded bitmap.</param>
        /// <returns></returns>
        public static async Task <WriteableBitmap> LoadAsync(
            this WriteableBitmap writeableBitmap,
            string relativePath,
            uint decodePixelWidth,
            uint decodePixelHeight)
        {
            var resolvedFile = await ScaledImageFile.Get(relativePath);

            return(await writeableBitmap.LoadAsync(
                       resolvedFile,
                       decodePixelWidth,
                       decodePixelHeight));
        }