I always thought that I was wondering why my other apps crashed almost 0, and the number of crashes in this app was just the inverse of the day, and I couldn't believe it.
There are at least thousands of crash every day ... I'm a costume too.
Not reconciled, take advantage of this refactoring opportunity, the code well smoothed 1
Debug.WriteLine ("beginrequest"+DateTime.Now); Progressring.visibility=visibility.visible; Progressring.isactive=true; varRepsonse =awaitHttphelper.getjsonasync<usgsearthquakesmodel>(Strrequesturl); if(Repsonse! =NULL&& Repsonse.metadata.status = = $) {Debug.WriteLine ("EndRequest"+DateTime.Now); Debug.WriteLine ("Beginxbind"+DateTime.Now); Debug.WriteLine ("Count"+repsonse.metadata.count); Obslist.clear (); if(Repsonse.metadata.count >0) { foreach(Featuresitem eminchrepsonse.features) {if(Em.properties.mag = =NULL) Continue; Try{standardearthquakesmodel sm=NewStandardearthquakesmodel { time=Helpers.TimeConverter.Convert2MyTime (em.properties.time), Mag= (Double) Em.properties.mag, Latitude= (Double) em.geometry.coordinates[1], Longitude= (Double) em.geometry.coordinates[0], Depth= (Double) em.geometry.coordinates[2], location=Em.properties.place,}; Obslist.add (SM); } Catch{}} pulltorefreshlistviewcontrol.itemssource=obslist; (Application.current asAPP). Gobsearthquakelist =obslist; Tipservices.tipupdatedata ((int) repsonse.metadata.count); Debug.WriteLine ("Endxbind"+DateTime.Now); } Else{tipservices.tipnodata (); } } Else{tipservices.tipneterror (); } progressring.visibility=visibility.collapsed; Progressring.isactive=false;
Look at getting json, look at bindings, look at the data model, it seems there is no problem ah.
The code is then commented out to see which part has the bug.
First comment out the code after response, you can determine to get response no cat cake.
Is there a problem with the try catch?
Exclude...
Then there is
Pulltorefreshlistviewcontrol.itemssource = obslist;
Have a problem???
That's what other apps say ...
After commenting, the final confirmation
Tipservices.tipupdatedata ((int) repsonse.metadata.count);
There's really a problem.
Let's go.
Public Static voidTipupdatedata (intncount) { if(Notifypopup! =NULL) notifypopup.hide (); if(Strcurrentlanguage.tolower (). Equals ("ZH-CN")) Notifypopup=NewNotifypopup (LANGUAGEHELPER.STRTIPDATAUPDATEDAMOUNT_ZH_CN +ncount); ElseNotifypopup=NewNotifypopup (ncount +languagehelper.strtipdataupdatedamount_en); Notifypopup.show (); Soundhelper.playsucceedtipsound (); }
This is similar to Android toast, other apps used countless times, how can there be bugs???
That's basically OK.
Soundhelper.playsucceedtipsound ();
This sentence hangs up.
Private Static Public Static void Playsucceedtipsound () {
MediaPlayer MediaPlayer = new MediaPlayer ();
= Mediasource.createfromuri (Thenew Uri ("ms-appx:///assets/skype.wav"
}
Take the MediaPlayer out and set it to static,??
Finally attach App:https://www.microsoft.com/store/apps/9n3x2jzp7b96
UWP Natural disaster apps stuck solution after refreshing data