Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Working with images from a PCL

$
0
0

Im creating an app using XLabs camerafunctionality but I do not understand how I can work with the images that gets saved on the disk of the device.
I use this code to take a photo:

public async Task TakePicture()
{
Setup ();

        ImageSource = null;

        return await _Mediapicker.TakePhotoAsync (new CameraMediaStorageOptions {
            DefaultCamera = CameraDevice.Front, MaxPixelDimension = 400
        }).ContinueWith (t => {
            if (t.IsFaulted)
            {
                Status = t.Exception.InnerException.ToString();
            }
            else if (t.IsCanceled)
            {
                Status = "Canceled";
            }
            else
            {
                var mediaFile = t.Result;
                ImageSource = ImageSource.FromStream(() => mediaFile.Source);


                string path = mediaFile.Path; //
                //Lets say I save all Paths to a DB for later use



                return mediaFile;
            }

            return null;
        }, _scheduler);
    }

So now I have acess to a list of Paths leading to images on the devices disk. Lets say that I now want to use my list of paths and display the images in a view (using Xaml). Do I have to do something platform-specifik in order to accomplish this? I see that the BitMapImage-class is used a lot but I cannot acess that class within my PCL. What would be the correct DataType to use?

Is there some samples demonstrating how to achieve this maybe?
Thank you!


Viewing all articles
Browse latest Browse all 58056

Trending Articles