Multiple threads in an app - HowTo

G

Guest

Hi!
In our current app we display a splash screen form(running on a separate
thread) while some data access operations take place. Once the operations are
finished, we display the main app form. This is working just fine.

Now, we are adding a functionality to see if a configurationsettings file on
the device has all the values we need before the app loads(even before the
splash screen). If a value doesn't exist, we display a form, get the
user-input, update the configuration file and then WANT to continue loading
the app.

This new form will only be displayed if some settings are missing. I am not
able to close this new form or kill the thread and continue loading the app.
How should I be resolving this issue? Any ideas/suggestions will help a lot.

Thanks and regards,
Kumar
 
C

Chris Tacke, eMVP

The problem is you're showing UI from a worker thread, which is a no-no
unless it has its own message pump.

-Chris
 
G

Guest

Message pump?? I am not sure I follow. What should be a better approach then
to do what I want to do?

Thank you for your time.
Regards,
Kumar
 
C

Chris Tacke, eMVP

The answer is either use the primary UI thread for displaying info through
Invoke calls or create a new message pump on your new thread to handle all
UI stuff for the new UI. I'd opt for the fisrt as the second has many
potentials for getting things seriously hosed up.

-Chris
 
G

Guest

Thank you Chris! I will prefer using the primary UI thread and modify the
logic or flow of the program.

Regards,
Kumar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top