【发布时间】:2014-12-14 02:15:48
【问题描述】:
所以我的Activity 中有一个Timer,我想每10 秒运行一次。
我创建了一个System.Threading.Timer:
timer = new Timer ((o) => {
Action syncAct = new Action (async delegate() {
await FetchData();
});
RunOnUiThread (syncAct);
}, null, 0, 10000);
这里的问题是await FetchData() 花费的时间超过 10 秒,这会导致计时器永远持续下去。每次同步完成后,我都需要启动计时器。我该怎么做?
感谢您的宝贵时间。
【问题讨论】:
标签: c# android multithreading timer xamarin