user1371640
user1371640

Reputation: 49

Media library Images

I am using visual studio for windows phone. Can we see the Image stored in media library in windows phone 7 emulator ? Is there any specific file location of such files?

Upvotes: 0

Views: 513

Answers (3)

Julien
Julien

Reputation: 3529

How to: Use the Photo Chooser Task for Windows Phone

try
{
    photoChooserTask.Show();
}
catch (System.InvalidOperationException ex)
{
    MessageBox.Show("An error occurred.");
}

void photoChooserTask_Completed(object sender, PhotoResult e)
{
    if (e.TaskResult == TaskResult.OK)
    {
        MessageBox.Show(e.ChosenPhoto.Length.ToString());

        //Code to display the photo on the page in an image control named myImage.
        //System.Windows.Media.Imaging.BitmapImage bmp = new System.Windows.Media.Imaging.BitmapImage();
        //bmp.SetSource(e.ChosenPhoto);
        //myImage.Source = bmp;
    }
}

Upvotes: 1

Ku6opr
Ku6opr

Reputation: 8126

Have you tried to get images with MediaLibrary class? Or you want to access images outside of your application, i.e. manage images with file manager?

MediaLibrary m = new MediaLibrary();
foreach (var p in m.Pictures)
{
    Debug.WriteLine(p.Name);
    Stream s = p.GetImage();
}

Upvotes: 1

coder
coder

Reputation: 13248

If you want to select the images from image library there is a photo chooser task class

   private void loadPhoto_Click(object sender, RoutedEventArgs e) 
    { 
        photoChooserTask.Show(); 
    } 

This now opens up a gallery of photos to choose from.

Upvotes: 0

Related Questions