Reputation: 963
Please do not close the question straight away. The almost similar problem is also discussed in the following threads.
But, these do not solve my problem. The problem never occurred in my development machine. It occurred in the user machine but not always. In fact it occurred only 3 or 4 times.
When it happens it seems the application/calling form is frozen. If I can guess (as I am not seeing it on the screen) where the close button is and click on it on the called form, it closes and application goes back to usable state until it occurs again.
My views are encapsulated within the presenter, so I am not calling ShowDialog()
from within the view but through the presenter.
MainPresenter
{
MainPresenter(IMainView view)
{
_view = view;
}
…
…
OpenSecondView()
{
var secondPresenter =_presenterFactory.Create<SecondPresenter>();
secondPresenter.Ininialize(_view);
}
}
// Initialize method in the SecondPresenter
Initialize(owner)
{
_secondView.ShowDialog(owner);
}
I am using observing presenter style of MVP explained here http://www.aspiringcraftsman.com/2008/11/23/model-view-presenter-styles/
Questions:
Show()
and set TopMost = true
, is it possible this problem
to occur?If Show()
absolutely guarantees that the problem will not occur, I will go with Show()
. I kind of lost faith in ShowDialog()
on this.
Any help will be greatly appreciated.
** The problem does not occur for a specific screen/view. It occurs randomly.
** For all the forms except main form, ShowInTaskBar is set to false.
Upvotes: 3
Views: 3876
Reputation: 2911
Have you tried adding a this.Activate()
in the load event for the form, because I have had a similar problem.
Upvotes: 0