【发布时间】:2011-12-15 22:47:52
【问题描述】:
这是一段代码,我在其中弹出了一个简单的对话框(“选择器”)。根据用户的输入,应用程序可能会终止。
DPChooser chooser = new DPChooser(dataProvider);
if (chooser.ShowDialog() == false)
Application.Current.Shutdown(0);
else
ApplicationContext.Current.InitializeDataProviderAPI(chooser.DataProvider);
}
// more code continues here
// THE PROBLEM:
// Even when Shutdown() above is called,
// the execution continues proceeding past here!
我已经在调试器中运行它,所以我知道 if 评估结果为假,并且我知道 Shutdown( ) 正在被调用。
那它为什么不关闭呢?
注意:我认为这不是线程问题。我还没有在其他线程上开始任何事情。即使涉及线程,我仍然不希望该线程中的代码继续通过 Shutdown()。
【问题讨论】: