0
我有從圖像庫中獲得的圖像,應該將其發送到服務器作爲基本字符串但是調用挑圖像是我轉移到當一個函數圖書館頁面,但不要等到我選擇繼續發送空的數據到服務器。使用Windows Phone上的圖像拾取劑量不會等到在Windows Phone 8選擇的圖像
public void Chplaceimg(string PlaceID)
{
YOimage changeplaceimg = new YOimage();
if (changeplaceimg.pickImage() != null)
{
var pairs = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string> ("id", _id),
new KeyValuePair<string, string> ("image", changeplaceimg._base64Image),
new KeyValuePair<string, string> ("place", PlaceID)
};
var serverData = serverConnection.connect("image.php", pairs);
}
}
public bool pickImage()
{
var photoChooserTask = new PhotoChooserTask();
photoChooserTask.Completed += PhotoChooserTaskCompleted;
photoChooserTask.Show();
return true;
}
//run function convertToBase64 when an image is choosed
private void PhotoChooserTaskCompleted(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK)
{
convertToBase64(e);
}
}
但功能和參數在不同的類 – MohamedAbbas
所以重新組織它,使之成爲可能。沒有其他方法,因爲WP是全部異步的,並且基於回調。 – MarcinJuraszek