Browse for image on Phone Windows Phone 7
I am creating Windows Phone 7 application. So far I've got login to Facebook account and post tex开发者_运维百科t to my wall. I want now upload image to my feed/album.
How can I browse for image on the phone and then selected image upload to Facebook feed/album?
Regars
try this code somewhere in your application:
public void ShowPhotoChooser()
{
PhotoChooserTask photoChooserTask = new PhotoChooserTask();
photoChooserTask.Completed += new EventHandler<PhotoResult>(photoChooserTask_Completed);
photoChooserTask.Show();
}
void photoChooserTask_Completed(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK)
{
System.Windows.Media.Imaging.BitmapImage bmp =
new System.Windows.Media.Imaging.BitmapImage();
bmp.SetSource(e.ChosenPhoto);
}
}
http://msdn.microsoft.com/en-us/library/ff769543(v=vs.92).aspx#BKMK_Photo
Should contain all you need to know.
Cheers!
精彩评论