Providing data to dialog

邮差的信 提交于 2019-12-13 02:50:05

问题


I have static class ControlCenter, which in time-intervals communicates with external system. For every single question&answer to external system my ControlCenter raises event which provides status information UI layer. Even if communication fails, event with error mesage is raised.
Now problem:
If there are some communication errors i want show form or dialog box in dialog mode so user can interact only with this showed UI item.
Even if there is an error, communication between ControlCenter and UI layer continues and I want provide to showed dialog actual data for exampl "Trying to reconnect....3rd try from 20 do you want kill service?"
I want be able hide this dialog form from itself by user click or programatically from its parent form (top ui layer).

I was trying create my own Form consuming event with data from its parent form and showing MyForm.ShowDialog(); but after showdialog() UIlayer waits on user action with dialog.

Do you know pls some walkthrough for this context?
Thank you very much.


回答1:


This question is very similar to yours and has a good answer with a sample. It boils down to using BackgroundWorker class for retrieving needed information.



来源:https://stackoverflow.com/questions/20270663/providing-data-to-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!