我有一个对象有一个计时器,它会在计时器达到5分钟时引发一个事件。在这个事件中,我在MainWindow.xaml.cs中调用MessageBox.Show(“Something”)。WPF调用MessageBox.Show异步
问题是,当我调用MessageBox.Show()时,计时器停止,直到用户点击确定。即使用户没有点击确定,我也需要定时器继续。是一个很好的,优雅的方式来做到这一点?这是我到目前为止已经试过(但不工作):
private void OnAlert(object sender, MvpEventArgs e)
{
this.Dispatcher.Invoke(
System.Windows.Threading.DispatcherPriority.Normal,
new Action(
delegate()
{
MessageBox.Show("Alert");
}
));
}