S
Serge
Hi,
I have some intensive code that is running on my main thread. I try to show
a status update on a 'status form'. The problem that i have is that because
it is running in the same thread the window is not responding to the user.
The user is now able to minimize, move the window because the code is too
busy on it's own work.
(and they are all running on the same thread)
I thought the solution would be to run the window on a seperate thread. so I
added the following code: 1 method called CreateStatusForm that creates the
form and assigns it to my variable _frmStatus, and my code running this
method in a seperate thread:
private void CreateStatusForm()
{
_frmStatus = new AdwareForm();
fInitializedStatus = true;
}
private AdwareTrace()
{
_oFormThread = new Thread(new ThreadStart(this.CreateStatusForm));
_oFormThread.Name = "Thread: StatusForm";
_oFormThread.Start();
while (oFormThread.IsAlive)
{
Thread.Sleep(250);
}
and so on ...
the problem is that on the initialization of the window runs on the seperate
thread.
After the initialization the window does not respond to the user again.
Can anybody tell me how to run forms on seperate threads so that the users
can continue to interact with it ?
Thanks very much in advance for your help,
Regards, SharpKnight
SharpKnight
I have some intensive code that is running on my main thread. I try to show
a status update on a 'status form'. The problem that i have is that because
it is running in the same thread the window is not responding to the user.
The user is now able to minimize, move the window because the code is too
busy on it's own work.
(and they are all running on the same thread)
I thought the solution would be to run the window on a seperate thread. so I
added the following code: 1 method called CreateStatusForm that creates the
form and assigns it to my variable _frmStatus, and my code running this
method in a seperate thread:
private void CreateStatusForm()
{
_frmStatus = new AdwareForm();
fInitializedStatus = true;
}
private AdwareTrace()
{
_oFormThread = new Thread(new ThreadStart(this.CreateStatusForm));
_oFormThread.Name = "Thread: StatusForm";
_oFormThread.Start();
while (oFormThread.IsAlive)
{
Thread.Sleep(250);
}
and so on ...
the problem is that on the initialization of the window runs on the seperate
thread.
After the initialization the window does not respond to the user again.
Can anybody tell me how to run forms on seperate threads so that the users
can continue to interact with it ?
Thanks very much in advance for your help,
Regards, SharpKnight
SharpKnight