0
    private async Task tick()
    {
        DateTime start = DateTime.Now;
        DateTime end = (DateTime)time1.Value;
        string expirationTime = (start.ToShortTimeString()) + (end.ToShortTimeString());
        ts1 = end.Subtract(start);
        messageTime = new DispatcherTimer();
        messageTime.Interval = TimeSpan.FromSeconds(ts1.TotalSeconds);
        messageTime.Tick += messageTime_Tick;
    }

    private void messageTime_Tick(object sender, object e)
    {
        if (ts1.TotalSeconds < 2)
        {
            MessageBox.Show("Done");
            message();
        }
    }

出于某种原因,我没有收到那个消息框说已完成。我在这里做错了吗?提前致谢!

4

1 回答 1

0
TimeSpan.FromSeconds(1);
messageTime.Start();
于 2013-06-30T21:28:27.323 回答