我需要獲取存儲在庫圖片中的照片的名稱。我有一個按鈕來創建新的EventHandler<PhotoResult>
和一個圖像控件來顯示照片。照片必須在圖書館圖片選擇WP的是這樣的:Windows phone 7:獲取存儲在Libary圖片中的照片名稱?
我用照片選擇:
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)