我在使用 Sequelize 的 expressJs 上遇到以下错误
DeprecationWarning: A boolean value was passed to options.operatorsAliases. This is a no-op with v5 and should be removed.
Run Code Online (Sandbox Code Playgroud)
有什么想法可以解决这个问题吗?
如何打破异步方法内部的while循环。请参考下面的代码
我尝试了很多方法,但没有一个对我有用
async void TotalTimer(string time)
{
while (true)
{
TimeSpan timesp = DateTime.Now - DateTime.Parse(time);
TotalTime = timesp.Hours + " : " + timesp.Minutes + " : " + timesp.Seconds;
await Task.Delay(1000);
if (string.IsNullOrEmpty(time))
{
break;
}
}
}
Run Code Online (Sandbox Code Playgroud)
我需要停止并退出循环
更新的代码:
async Task TotalTimer(CancellationToken token)
{
var intime = await App.Database.GetRecentIn();
InTime = DateTime.Parse(intime.datetime).ToString("hh:mm tt");
while (!token.IsCancellationRequested)
{
TimeSpan timesp = DateTime.Now - DateTime.Parse(intime.datetime);
TotalTime = timesp.Hours + " : " + timesp.Minutes + " : " + timesp.Seconds; …Run Code Online (Sandbox Code Playgroud)