开发者

ShowDialog issue on Close

I am sometimes seeing an issue with Window.ShowDialog() where the window physically closes but does not return to the ShowDialog point in the code from where it was shown.

I have the following:

try
{
    log.Debug("Showing new dialog window.");
    result = dialogWindow.ShowDialog();
    log.Debug("Closing new dialog window.");
}
finally
{
    log.Debug("Resetting Opacity: " + this.ToString());
    Opacity = 1;
    Lock.Release(dialogWindowPadLock);    
}

When the window tries to Close() itself, it dissapears but the Opacity is not set back to 1 and the window is still recieveing KeyUp events but it is not physically displayed.

Has anyone seen anything like this before?

Cheers,

James

As requested, the method to close the window:

public override void EnterPressed(string input)
{
    log.Info("User [" + username + "] successfully activated");

    StopNextUserCheck();
    Act开发者_高级运维ivateUserExitReason = ExitReason.UserActivated;

    Close();

    // don't break as we don't want to add the dbp listener

    return;
}


I am not sure I understood your question, but maybe try to set the opacity changing in the window closing event.

Also, try to manually set the DialogResult of the opened window.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜