I am developing a plugin for an application, this application "consumes" my code (classLibrary) and executes the method Init()inside its own Thread. Inside Init () I have a statement while(true)so that my plugin can run continuously.
Yesterday I started creating windowsForm to configure my plugin (using XML), and now I want to show it, but it continues to disappear. My code is as follows:
As a result of this, the form will be displayed, but it will not be re-drawn, because it starts in the same thread as while (true).
MaForm settingsForm = null;
void init(){
While(true){
if(settingsForm == null){
settingsForm = new MaForm();
settingsForm.show();
}
}
}
A version that shows but then disappears.
MaForm settingsForm = null;
Thread worker = null;
void init(){
While(true){
if(worker == null){
worker = new Thread(new ThreadStart(formStuff));
worker.Start();
}
}
}
void formStuff()
{
if(settingsForm == null){
settingsForm = new MaForm();
settingsForm.show();
}
}
What am I doing wrong? Is there something in Threading that I don't see? What do you guys think?