Reputation: 3884
I am trying to find out reason why ShowDialog() is not showing the dialog box for me. I have an application where I have a credential dialog box(A) for the user to enter credentials. And I have another dialog box(B) to display some custom msg based on the user's credential. After the user enter's credentials in A, I am doing something with it. when I am trying to show the msg in B, ShowDialog() is not showing dialog B.
Can you guys think of any reason?
Here is the code:
bool isInternetConnected = class.CheckInternetConnection(ref error);
if(!String.IsnUllOrEMpty(error))
{
DialogBox dialogBox = new DialogBox();
dialogBox.Title = "Credentials";
dialogBox.State = DialogBox.States.NoFooter;
dialogBox.ShowInTaskbar = false;
CredentialsContent Credentials = new CredentialsContent();
Credentials.ContentCompleted += new EventHandler<ContentCompletedEventArgs>(
dialogBox.OnContentCompleted);
dialogBox.MainContent = Credentials;
bool? result = dialogBox.ShowDialog();
hasAccess = result.HasValue ? result.Value : false;
}
UpdateDialog updateDialog = new UpdateDialog();
updateDialog.ShowModal = true;
bool? isTrue = updateDialog.ShowDialog();
Upvotes: 1
Views: 2903
Reputation: 3884
I got it resolved. What was happening is that windows was treating the first window(A) as main window.When it was getting closed the next window(B) as inconsequential. So even with showdialog() it was not showing it.
The trick was to define UpdateDialog() at the start of the application. The same question is answered here: Open new window after first
Upvotes: 2