我有这个代码:
if (!App.stopWatch.IsRunning) { App.stopWatch.Start(); }
Device.StartTimer(new TimeSpan(0, 0, 1), () =>
{
if (App.stopWatch.IsRunning && App.stopWatch.Elapsed.Seconds >= 60)
{
Console.WriteLine("Reducing Points");
App.stopWatch.Restart();
}
return true;
});
我希望每60秒它就会进入if并向控制台写入一条消息。但是当我在调试模式下运行时,它永远不会到达那里,更让我困惑的是,stopWatch经过的时间增加到60,然后重置。有没有人知道为什么会发生这种情况?
阿晨1998
相关分类