我正在警告用户完成的过程如下:
var result = MessageBox.Show("Completed!!", "Upload Status", MessageBoxButton.OK, MessageBoxImage.Information);
if (result == MessageBoxResult.OK)
{
result = MessageBox.Show("Do you want to Quit the application ?", "Quit Application", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
OpenWebSite();
// I want to close the message box and complete application.
}
}
如果我写这个。关闭..它正在给出异常,所以我这样写了:
Dispatcher.BeginInvoke(new Action(() => { this.Close(); }));
两次单击[Yes]按钮后页面仍然关闭,这使得OpenWebSite();
被调用两次。 ...
对导致这种情况的原因有什么想法?
答案 0 :(得分:0)
使用Application.Current.Shutdown()