views:

166

answers:

1

Hi,

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;
}
+1  A: 

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.

Shimmy
The issue is not the opacity as such just an indicator of the problem. The issue is even though I close the window shown by result = dialogWindow.ShowDialog(); it never executes anything after this line.
James
I edited my answer, maybe it will help you.
Shimmy