一直以为都在纳闷,为啥我的其他app崩溃次数几乎为0,而单单这个App的崩溃次数简直逆天了,我都不敢相信。

每天都有至少上千次crash。。。我也是服的

不甘心,趁着这次重构的机会,把代码好好捋了1下

Debug.WriteLine("BeginRequest " + DateTime.Now);
progressRing.Visibility = Visibility.Visible;
progressRing.IsActive = true; var repsonse = await HttpHelper.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 > )
{
foreach (FeaturesItem em in repsonse.features)
{
if (em.properties.mag == null)
continue; try
{
StandardEarthquakesModel sm = new StandardEarthquakesModel
{
Time = Helpers.TimeConverter.Convert2MyTime(em.properties.time),
Mag = (double)em.properties.mag,
Latitude = (double)em.geometry.coordinates[],
Longitude = (double)em.geometry.coordinates[],
Depth = (double)em.geometry.coordinates[],
Location = em.properties.place,
};
ObsList.Add(sm);
}
catch { }
} PullToRefreshListViewControl.ItemsSource = ObsList;
(Application.Current as App).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;

看获取json,看绑定,看数据模型,貌似都没啥问题啊。

于是就把代码分块注释掉,看看哪一部分有bug。

首先注释掉response之后代码,可以确定获取response没猫饼。

难道try catch有问题?

排除。。。

接着就是

PullToRefreshListViewControl.ItemsSource = ObsList;

有问题???

其他app也是这么写的啊。。。

注释一番后,最终确定

TipServices.TipUpdateData((int)repsonse.metadata.count);

真的有问题。

进去看看

public static void TipUpdateData(int nCount)
{
if (notifyPopup != null)
notifyPopup.Hide();
if (strCurrentLanguage.ToLower().Equals("zh-cn"))
notifyPopup = new NotifyPopup(LanguageHelper.strTipDataUpdatedAmount_zh_cn + nCount);
else
notifyPopup = new NotifyPopup(nCount + LanguageHelper.strTipDataUpdatedAmount_en);
notifyPopup.Show(); SoundHelper.PlaySucceedTipSound();
}

这个类似安卓toast,其他app用过无数次,怎么会有bug???

那基本可以确定

SoundHelper.PlaySucceedTipSound();

这句话挂了。

private static public static void PlaySucceedTipSound()
{
  MediaPlayer mediaPlayer = new MediaPlayer();
  mediaPlayer.Source = MediaSource.CreateFromUri(new Uri("ms-appx:///Assets/Skype.wav")); 
  mediaPlayer.Play();
}

把MediaPlayer拿出来设置成静态,

UWP 自然灾害App在刷新数据后卡死的解决方案的更多相关文章

  1. POI刷新数据后的函数(公式)更新问题

    使用POI将Excel模板中的数据进行更新,这应该是很常见的操作 下面就贴上我的一小段代码 public class ModifyExcel { /** * @param fileName Excel ...

  2. pymysql 读取大数据内存卡死的解决方案

    背景:目前表中只有5G(后期持续增长),但是其中一个字段(以下称为detail字段)存了2M(不一定2M,部分为0,平均下来就是2M),字段中存的是一个数组,数组中存N个json数据.这个字段如下: ...

  3. Adapter刷新数据的坑

    adapter刷新数据的时候,要能够刷新成功,要保证每次刷新的时候都是改变数据源. 于是,我这样做了,在适配器的构造方法里面写到: private List<ListBean> listI ...

  4. DataGridView重新加载数据后,选中上次选中的行。

    public int SelecedRow;//记录当前鼠标点中的行索引(用于解决用户获取看板数据,刷新数据后,当前选中行回到默认行) private void dataGridView1_CellC ...

  5. UWP开发:APP之间的数据交互(以微信为例)

    目录 说明 UWP应用唤醒方式 跟微信APP交互数据 APP之间交互数据的前提 说明 我们经常看到,在手机上不需要退到桌面,APP之间就可以相互切换,并且可以传递数据.比如我在使用知乎APP的时候,需 ...

  6. js实现非模态窗口增加数据后刷新父窗口数据

    父窗口是由两个部分组成,一个html的table,一部分是extjs的gird. 点击grid面板[增加]按钮将会弹出非模态窗口进行新数据的编辑页面 下面是按钮的触发函数代码: var a = win ...

  7. Ajax请求数据与删除数据后刷新页面

    1.ajax异步请求数据后填入模态框 请求数据的按钮(HTML) <a class="queryA" href="javascript:void(0)" ...

  8. IDEA 修改JSP和后端数据后,页面刷新可以实时更新

    情况:刚开始使用IDEA进行开发时,发现修改JSP页面或者后端数据后,再刷新浏览器页面,发现没有变化,页面无更新. 这样就导致不得不频繁重启tomcat服务器.非常麻烦 解决方法: 步骤1. 先设置t ...

  9. 解决Vuex持久化插件-在F5刷新页面后数据不见的问题

    页面刷新后,想保存页面未保存的数据.我们总是习惯于放在浏览器的sessionStorage和localStorage中.但是用了vue后,vuex便可以被应用了. vuex优势:相比sessionSt ...

随机推荐

  1. matlab 函数句柄@的介绍_什么是函数句柄(转)

    http://blog.csdn.net/kevinhg/article/details/8861774 http://www.ilovematlab.cn/thread-30375-1-1.html ...

  2. shell命令工作总结

    shell命令工作总结: 1.sed命令:1.1.将文本input.txt中含有”姓名”字符串的行中的谢朝辉替换成扎巴依:sed -e '/姓名/s/谢朝辉/扎巴依/g' input.txt1.2.将 ...

  3. python 统计学的各种检验

    1.使用python中的Numpy进行t检验 http://www.atyun.com/7476.html 2.scipy中的卡方检验 http://wiki.mbalib.com/wiki/%E5% ...

  4. ES(ElasticSearch)学习总结

    基本概念 一个分布式多用户能力的全文搜索引擎,基于RESTful web接口. Elasticsearch和MongoDB/Redis/Memcache一样,是非关系型数据库.是一个接近实时的搜索平台 ...

  5. Notepad++调用python

    ***首先确保在cmd下能直接运行python*** (博主的环境:win10 下2和3共存) 接下来进入主题,用Notepad++打开py文件,然后按 F5 键弹出运行窗口,输入以下内容: pyth ...

  6. C# 词法分析器(一)词法分析介绍

    系列导航 (一)词法分析介绍 (二)输入缓冲和代码定位 (三)正则表达式 (四)构造 NFA (五)转换 DFA (六)构造词法分析器 (七)总结 虽然文章的标题是词法分析,但首先还是要从编译原理说开 ...

  7. python decorator的本质

    推荐查看博客:python的修饰器 对于Python的这个@注解语法糖- Syntactic Sugar 来说,当你在用某个@decorator来修饰某个函数func时,如下所示: @decorato ...

  8. Sequelize-nodejs-13-Working with legacy tables

    Working with legacy tables使用遗留表 While out of the box Sequelize will seem a bit opinionated it's triv ...

  9. selenium+python unittest实践过程之问题杂集

    1.列表选择项后直接获取文本内容获取不到,应该获取选择后显示的button的值 2.取值后的值带有空格,可以使用.strip()删除前后空格,以便断言 3.取值后有些值需要对类型进行转换才能断言成功 ...

  10. LeetCode429. N-ary Tree Level Order Traversal

    题目来源:429. N-ary Tree Level Order Traversal https://leetcode.com/problems/n-ary-tree-level-order-trav ...