Hello All, We have two applications in .NET 2.0 C#. App1 communicates with App2 throught App2's COM layer. App1 has the ability to load some of the forms exposed by App2. The problem is when the user tries to load the form from App2 for the first time the whole GUI freezes up as the UI thread gets busy in loading all the dlls etc and it sometimes takes up to 2~3 mins. to load one form. Once all the Dlls are loaded the performace of loading forms from App2 improves. I tried to put the form loading calls into a worker thread and am showing a progress window, this keeps my main thread responsive and when the form is created I save its reference in a class level variable to access it from main thread after the worker has stopped. The problem is when the worker thread is done loading the form and I call the Thread.Join, the form that I got from App2 also gets killed. I think it is related to that windows rule that says the control will only exist in the thread that creates it. Any ideas how to solve this problem?
My first move would be first to check why it takes 2-3 minutes. This is not something that looks like a normal behavior to me. Adding threading would hide the problem rather than solving it and then you'll have the added complexity of running the UI into several threads and AFAIK this is really not an usual situation... -- Patrice a écrit dans le message de groupe de discussion : a303ecb5-9bd6-4cdf-9c5b-9dc3e97e3c0f@i20g2000prf.googlegroups.com... > > Hello All, > > We have two applications in .NET 2.0 C#. > > App1 communicates with App2 throught App2's COM layer. App1 has the > ability to load some of the forms exposed by App2. > > The problem is when the user tries to load the form from App2 for the > first time the whole GUI freezes up as the UI thread gets busy in > loading all the dlls etc and it sometimes takes up to 2~3 mins. to > load one form. Once all the Dlls are loaded the performace of loading > forms from App2 improves. > > I tried to put the form loading calls into a worker thread and am > showing a progress window, this keeps my main thread responsive and > when the form is created I save its reference in a class level > variable to access it from main thread after the worker has stopped. > The problem is when the worker thread is done loading the form and I > call the Thread.Join, the form that I got from App2 also gets killed. > > I think it is related to that windows rule that says the control will > only exist in the thread that creates it. > > Any ideas how to solve this problem? > > >
On 29 Aug, 17:10, "Patrice" <http://www.chez.com/scribe/> wrote: > My first move would be first to check why it takes 2-3 minutes. This is not > something that looks like a normal behavior to me. Adding threading would > hide the problem rather than solving it and then you'll have the added > complexity of running the UI into several threads and AFAIK this is really > not an usual situation... > > -- > Patrice > > a écrit dans le message de groupe de discussion > a303ecb5-9bd6-4cdf-9c5b-9dc3e97e3...@i20g2000prf.googlegroups.com... > > > > > > > Hello All, > > > We have two applications in .NET 2.0 C#. > > > App1 communicates with App2 throught App2's COM layer. App1 has the > > ability to load some of the forms exposed by App2. > > > The problem is when the user tries to load the form from App2 for the > > first time the whole GUI freezes up as the UI thread gets busy in > > loading all the dlls etc and it sometimes takes up to 2~3 mins. to > > load one form. Once all the Dlls are loaded the performace of loading > > forms from App2 improves. > > > I tried to put the form loading calls into a worker thread and am > > showing a progress window, this keeps my main thread responsive and > > when the form is created I save its reference in a class level > > variable to access it from main thread after the worker has stopped. > > The problem is when the worker thread is done loading the form and I > > call the Thread.Join, the form that I got from App2 also gets killed. > > > I think it is related to that windows rule that says the control will > > only exist in the thread that creates it. > > > Any ideas how to solve this problem?- Hide quoted text - > > - Show quoted text - Patrice, The slow loading on first call is due to the fact that App2 connects to different systems to load the cache data that is needed by the form. So we cannot do anything about that. Nad