c# - Loading page in Windows Phone 8.1 with async method -


i want display loding circle bar, while page in windows phone loading. latency due async method, donwloads json file , concert list of objects. problem, if async method in class ? also, how can result of aysnc method in class/page ?

write code in separate class

public class result  {    public string message {get;set} } public class utility {    public async task<result> getjson()    {        //do here        return result;    } } 

then call this:

loadingindicator.visibility = visibility.visible; await utility.getjson() loadingindicator.visibility = visibility.collapsed; 

and add page xaml:

<grid>     <!-- other ui elements -->     <stackpanel x:name="loadingindicator" verticalalignment="center" horizontalalignment="center" visibility="collapsed">         <textblock text="loading..."/>         <progressring isactive="true" verticalalignment="center"/>     </stackpanel> </grid> 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -