C# MessageBox在WPF应用程序中自动关闭
我有一个messagebox问题,它正在显示,但在WPF应用程序中会立即关闭。我的代码:C# MessageBox在WPF应用程序中自动关闭,c#,wpf,C#,Wpf,我有一个messagebox问题,它正在显示,但在WPF应用程序中会立即关闭。我的代码: string messageTitle = Quarantine.Localizer.LocalizedStringForStatusCode("TITLE_GENERATEDSUPPORTFILE"); string message = ""; MessageBoxIcon messageIcon = MessageBoxIcon.Information; try { ServiceContro
string messageTitle = Quarantine.Localizer.LocalizedStringForStatusCode("TITLE_GENERATEDSUPPORTFILE");
string message = "";
MessageBoxIcon messageIcon = MessageBoxIcon.Information;
try
{
ServiceController.GenerateSupportArchive(archivePath);
message = String.Format("{0} {1}", Quarantine.Localizer.LocalizedStringForStatusCode("DIALOG_GENERATEDSUPPORTFILE"), archivePath);
}
catch (Exception exp)
{
message = String.Format("{0}.\n\nError: {1}",
Quarantine.Localizer.LocalizedStringForStatusCode("DIALOG_GENERATEDSUPPORTFILEFAIL"),
exp.Message);
messageIcon = MessageBoxIcon.Error;
}
System.Windows.Forms.MessageBox.Show(message, messageTitle, MessageBoxButtons.OK, messageIcon);
MessageBox在屏幕上可以看到的短暂闪光中正确显示,我只是想弄清楚为什么在按下OK按钮之前它会自动关闭。这是使用MahApps.Metro社区资源窗口WS 8外观的WPF应用程序。System.Windows。表格,留言盒?请不要将表单拖到WPF应用程序中。使用。我已编辑代码,以便调用System.Windows.MessageBox而不是System.Windows.Forms.MessageBox。同样的问题。当前代码System.Windows.MessageBox.Showmessage、messageTitle、MessageBoxButton.OK;我有完全相同的问题,但只有一个消息框。