我需要有关日期时间的帮助。
我希望我的应用程序检查 DateTime 是否结束并给我一个消息框。
我该怎么写?
代码:
private void listjob()
{
DispatcherTimer dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(listjob3_Tick);
dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 1);
dispatcherTimer.Start();
}
private void listjob3_Tick(object sender, EventArgs e)
{
if (listbox3job())
{
DateTime? start = DateTimePicker1.Value;
DateTime? end = DateTimePicker2.Value;
DateTime now = DateTime.Now;
if (?) // here is what I want it to check if end time is started
{
Xceed.Wpf.Toolkit.MessageBox.Show("End Time started");
DispatcherTimer timer = (DispatcherTimer)sender;
timer.Stop();
timer = null;
}
}
}