c# - Windows Phone 8.1 Showing progress view until async/await task finishes -
i have 2 tasks download mp3 web address inside local storage , returns timespan.
public async task<timespan> filedownload_ignition_outside() { uri sourceignition_outside = new uri(temporaryaddress.download_playcarsound+"ignition_outside"); //download , store file return duration_ignition_outside; } public async task<timespan> filedownload_idle_outside() { uri sourceidle_outside = new uri(temporaryaddress.download_playcarsound +"idle_outside"); storagefile destinationfileidle_outside; //download , store file return duration_idle_outside; }
now need show indeterminate progressbar in ui while downloading starts till ends dont know how find task completed?
on navigatedto function have set async , calling await downloadfile();
now inside downloadfile()
public async task<timespan> downloadfiles() { //progressshow var temp= await filedownload_ignition_outside(); //if (filedownload_ignition_outside().iscompleted) //{ // //progressstop //} return temp; }
but not executing stop statement waits asynchronously how can event both task gets finished?
can call both tasks inside downloadfiles() method , still able event both task completion.
try similar code given below in onnavigatedto
event.
showprogress=true; downloadfiles().continuewith((sender) => { this.dispatcher.runasync(coredispatcherpriority.normal, () => showprogress=false; ); });
you need run showprogress=false;
in ui thread
Comments
Post a Comment