android - Xamarin: Unsure what to cast using DriveFile.Open -
i tried lookup documentation drivefile.open xamarin still can't find class cast return statement code below
var pendingresult = drivefile.open(.. , .., ..) var obj = pendingresult.await();
on android documentation, class casting
drivecontents drivecontents = drivecontentsresult.getdrivecontents();
but can't find class called drivecontentsresult.
non-async way (using onresult
callback)
drivefile.open(_googleapiclient, drivefile.modereadonly, null).setresultcallback(this);
will call onresult
, there can cast result:
void iresultcallback.onresult(java.lang.object result) { var contentresults = (result).javacast<idriveapidrivecontentsresult>(); var drivecontent = contentresults.drivecontents; d.writeline(drivecontent.driveid); }
async way:
var drivecontentresult = drivefile.openasync(_googleapiclient, drivefile.modereadonly, null).continuewith((resulttask) => { var drivecontentresults = resulttask.result; var drivecontent = drivecontentresults.drivecontents; d.writeline(drivecontent.driveid); });
Comments
Post a Comment