简体   繁体   English

WPF Window.ShowDialog()在第二次调用时立即返回

[英]WPF Window.ShowDialog() returns immediately on second call

In my app I have the following code: 在我的应用中,我有以下代码:

void ShowCaptchaWindow(Exception ex)
{
    var window = new CaptchaWindow(ex);
    window.Left = 800;
    window.Top = 500;
    window.ShowDialog();

    text = window.CaptchaText;
}

This code used to work fine before, but now I got problems with it. 该代码以前可以正常工作,但是现在我遇到了问题。 Strange thing is that I dont remember that I've changed anything. 奇怪的是,我不记得自己做了什么更改。

When I call the function for the first time - everything is Ok, window is showing and function waits for it to close. 当我第一次调用该函数时-一切正常,窗口显示,函数等待它关闭。 But when I call this function for the second time - window doesnt displayed and I immediately goes to the next line. 但是,当我第二次调用此函数时-窗口不显示,我立即转到下一行。

问题是我在显示应用程序的MainWindow之前显示了CaptchaWindow。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM