c# - How to get JSON data very fast from URL in windows phone 8.1 app? -
i developing 1 windows phone app.
in app getting json data service url , binding list box. and, in json data has 2500 cities. these cities came service , binding list box take 5 minutes time.
then how getting data fast service? please me.
below code:
public async void insertcities() { try { await this.dispatcher.runasync(windows.ui.core.coredispatcherpriority.normal, async () => { var busclient = new newpavanapp.jsonwebclient(); var busresp1 = await busclient.dorequestasync(url.weburl + "getcities"); string busresult1 = busresp1.readtoend(); jarray busjsonarray = jarray.parse(busresult1); (int j = 0; j < busjsonarray.count; j++) { jobject jobj = (jobject)busjsonarray[j]; string id = (string)jobj["cityid"]; string cityname = (string)jobj["cityname"]; city cit = new city(); cit.cityname = cityname; fromcityname1.items.add(cityname); tocityname1.items.add(cityname); db_helper.insert(new buscities(id, cityname)); userprofilelist.add(cit); // citieslist.add(cityname); } });
ok, first: code fragment isn't enough reproduce problem, think code getting data fine , have problem binding.
you wrote:
these cities came service , binding list box take 5 minutes time.
check, how time need download data without binding. because binding time-consuming operation. if try bind 2500 elements , don't use virtualization can problem on windows phone. try use listview virtualization (it can helpful).
@update (17:30 - 12.10.2015)
yes.its download data fast.but whenever binding data time taking time.then should do.please me.please give me sample.
ok, in opinion: shouldn't bind elements in same time. read incremental loading in listbox (load more items listbox when scrolled bottom). can download items, , add itemssource part of them, , after user scroll end load more.
Comments
Post a Comment