我需要获取存储在库图片中的照片的名称。我有一个按钮来创建新EventHandler<PhotoResult>
的和一个图像控件来显示照片。照片必须在 WP 的 Library Picture 中选择,如下所示:
我使用了照片选择器:
private void button1_Click(object sender, RoutedEventArgs e)
{
PhotoChooserTask objPhotoChooser = new PhotoChooserTask();
objPhotoChooser.Completed += new EventHandler<PhotoResult>(PhotoChooseCall);
objPhotoChooser.Show();
}
void PhotoChooseCall(object sender, PhotoResult e)
{
switch (e.TaskResult)
{
case TaskResult.OK:
BinaryReader objReader = new BinaryReader(e.ChosenPhoto);
image1.Source = new BitmapImage(new Uri(e.OriginalFileName));
MessageBox.Show("Photo's name: " + e.OriginalFileName.ToString());
break;
case TaskResult.Cancel:
MessageBox.Show("Cancelled");
break;
case TaskResult.None:
MessageBox.Show("Nothing Entered");
break;
}
}
但输出是照片的路径,而不是名称:
照片名称:\Applications\Data\C80566AB-E17E-495C-81A1-3FCAE34D3DEDE\Data\PlatformData\PhotoChooser-a8208960-3597-40fc-9b4f-869afcf822b6.jpg
怎样才能得到照片的名字???(我需要得到PhotoChooser-a8208960-3597-40fc-9b4f-869afcf822b6.jpg)