James
James

Reputation: 3625

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();
    ActivateUserExitReason = ExitReason.UserActivated;

    Close();

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

    return;
}

Upvotes: 0

Views: 1185

Answers (1)

Shimmy Weitzhandler
Shimmy Weitzhandler

Reputation: 104692

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.

Upvotes: 1

Related Questions