0
我正在開發和應用在android的xamarin中。有兩個按鈕用於上傳Parse對象,另一個用於下載對象並顯示Image。上傳按鈕工作正常。但我面臨兩個主要問題從解析和顯示下載ParseObject
第一:我在我的IEnumerable對象中得到一個空值。我附上了我的斷點值的截圖。
第二:當我嘗試顯示對象時出現錯誤。我附上顯示
上傳按鈕錯誤的截圖:
upbutton.Click += async delegate {
try {
byte[] myfile = System.IO.File.ReadAllBytes (path);
ParseFile file = new ParseFile ("imgfl.png", myfile);
await file.SaveAsync();
// link your file object to your Parse object
ParseObject gameScore = new ParseObject ("GameScore");
gameScore ["score"] = 0001;
gameScore ["playerName"] = " Bob";
gameScore ["image"] = file;
await gameScore.SaveAsync();
} catch (Exception e) {
System.Console.WriteLine (e);
}
};
下載按鈕:
downbutton.Click+= async delegate {
var query = from GameScore in ParseObject.GetQuery("GameScore")
orderby GameScore.CreatedAt descending
select GameScore;
IEnumerable<ParseObject> results = await query.FindAsync();
//I am getting a null object result here
foreach (var obj in results)
{
ParseFile img = obj.Get<ParseFile>("image");
_imageView.SetImageURI(img.Url);
//error here
}
};
實際上,從解析下載所有對象後,我想在列表視圖中顯示它們。 「圖像」和「玩家名稱」。我是新來的android,所以我沒有太多關於其UI控制的知識。你能幫我解決這個問題嗎?非常感謝 – Bedant