Georgi
Georgi

Reputation: 529

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.

Upvotes: 1

Views: 217

Answers (1)

Will Dean
Will Dean

Reputation: 39500

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.

Upvotes: 2

Related Questions