Ejemplo n.º 1
0
        public Task <bool> LoadImageAsync(Native.Image image, ImageSource imageSource, CancellationToken cancelationToken = default(CancellationToken))
        {
            var urisource = imageSource as UriImageSource;

            if (urisource != null && urisource.Uri != null)
            {
                return(image.LoadAsync(urisource.Uri, cancelationToken));
            }

            return(Task.FromResult <bool>(false));
        }
Ejemplo n.º 2
0
        public Task <bool> LoadImageAsync(Native.Image image, ImageSource imageSource, CancellationToken cancelationToken = default(CancellationToken))
        {
            var filesource = imageSource as FileImageSource;

            if (filesource != null)
            {
                string file = filesource.File;
                if (!string.IsNullOrEmpty(file))
                {
                    return(image.LoadAsync(ResourcePath.GetPath(file), cancelationToken));
                }
            }
            return(Task.FromResult <bool>(false));
        }
Ejemplo n.º 3
0
        public async Task <bool> LoadImageAsync(Native.Image image, ImageSource imageSource, CancellationToken cancelationToken = default(CancellationToken))
        {
            var streamsource = imageSource as StreamImageSource;

            if (streamsource != null && streamsource.Stream != null)
            {
                using (var streamImage = await((IStreamImageSource)streamsource).GetStreamAsync(cancelationToken))
                {
                    if (streamImage != null)
                    {
                        return(await image.LoadAsync(streamImage, cancelationToken));
                    }
                }
            }
            return(false);
        }