c# - How to show loading message while making a json request on windows phone? -
i need show loading message, while json request made on windows phone, async task progressdialog on android, put dialog.show() on onpreexecute() , dialog.dismiss() on onpostexecute. how can on windows phone?
here json request:
webclient webclient = new webclient(); webclient.downloadstringcompleted += new downloadstringcompletedeventhandler(webclient_downloadstringcompleted); webclient.downloadstringasync(new uri("https://maps.googleapis.com/maps/api/place/textsearch/json?&query=taxi&location=-19.94549444,-43.92314218&&radius=5000&sensor=true&key=aizasyducc8qbv5wu4v-dqxffabxgaauzdmt5xw"));
while request downloading, need show loading message, , ent when request complete.
you can display progress bar indicate ongoing process.
put code follows:
webclient webclient = new webclient(); webclient.downloadstringcompleted += new downloadstringcompletedeventhandler(webclient_downloadstringcompleted); progressindicator progressindicator = new progressindicator() { isvisible = true, isindeterminate = false, text = "loading..." }; systemtray.setprogressindicator(this, progressindicator); webclient.downloadstringasync(new uri("https://maps.googleapis.com/maps/api/place/textsearch/json?&query=taxi&location=-19.94549444,-43.92314218&&radius=5000&sensor=true&key=aizasyducc8qbv5wu4v-dqxffabxgaauzdmt5xw"));
this display progress bar request begin execute.
stop after load, add following code event handler:
void webclient_downloadstringcompleted(s, e) { dispatcher.begininvoke( () => { progressindicator.isvisible = false; // code }); }
Comments
Post a Comment