简体   繁体   中英

ShowDialog in Background worker

I have a problem. I have a loginUI and when logging I download files that I need. I use backgroundworker for the downloading and for the loginUI form. When I call loginUI.ShowDialog(); is just like calling loginUI.Show()(I can go to the main form). Do you know a way to make it work. I think it's something with begin invoke, but I am not sure.

Do the UI parts of your app in the Form class - do the login before starting the background work, so that the modal dialog correctly blocks your UI thread.

You should not need to be using Invoke manually if you're using BackgroundWorker correctly - it does all that sort of stuff for you with its progress and completion messages.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM