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.
您是否尝试在表单的load事件中添加this.Activate()
,因为我遇到了类似的问题。
您可以尝试使用TopMost = true
作为表单
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.