コード例 #1
0
        public async Task <BitmapImage> OpenPhoto(SourceType type)
        {
            switch (type)
            {
            case SourceType.Camera:
                this.photo = await ImageGetter.FromCamera();

                break;

            case SourceType.File:
                this.photo = await ImageGetter.FromDisk();

                break;
            }
            if (this.photo == null)
            {
                return(null);
            }

            var stream = await photo.OpenReadAsync();

            BitmapImage imageSource = new BitmapImage();
            await imageSource.SetSourceAsync(stream);

            return(imageSource);
        }