1
我要上傳,選擇照片來分析這裏對象 我們將選擇照片由galery如何上傳選擇的圖像來解析對象?
private void ChosePhoto_Click(object sender, RoutedEventArgs e)
{
CamerChoooserTask = new PhotoChooserTask();
CamerChoooserTask.Completed += new EventHandler<PhotoResult>(CamerChoooserTask_Completed);
CamerChoooserTask.Show();
}
private void CamerChoooserTask_Completed(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK && e.ChosenPhoto != null)
{
imgto.Source = null;
MessageBox.Show(e.ChosenPhoto.Length.ToString());
App.ChoosedImage = PictureDecoder.DecodeJpeg(e.ChosenPhoto);
imgto.Source = App.ChoosedImage;
}
}
.. 現在我們要Uplaod到對象
private async void UploadPhotoBtn_Click(object sender, RoutedEventArgs e)
{
// here I want to but my photo in array ..
byte[] data = System.Text.Encoding.UTF8.GetBytes("Working at Parse is great!");
ParseFile file = new ParseFile("resume.txt", data);
var photo = new ParseObject("photo");
photo["Photo"] = file;
await photo.SaveAsync();
}
注:在解析的.Net指導文件是文本編碼 我想在這裏我需要將照片轉換爲二進制 我該怎麼辦?