UWP Natural disaster apps stuck solution after refreshing data

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.