473,320 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

timer, threading and appDomain ... complicated question

Hi all

I have some trouble with threading and AppDomain ... :-((

Within a MDI Container Form,
I am loading a assembly into a AppDomain like this:
"System.AppDomain local_AppDomainPlugIn =
System.AppDomain.CreateDomain("SomeName");"

and calling Method remote Load like this:
"local_AppDomainPlugIn.DoCallBack(new
System.CrossAppDomainDelegate(local_InterfaceObjec t.remote_Load));"

The method remote_Load is showing a new form within the MDI Container Form.
When I call this (in MDI Container Load), it works fine.
Now I have new a timer which should do this calling,
but of corse the timer runs in another thread then MDI Container Form.
When I now call it, the new form loads but it is frozen ... :-(((

I am a little lost now because I do not know what is
the best way to do it ??
I know it would work like this:
"this.Invoke(new delegateLoad(local_InterfaceObject.remote_Load));"
but I need to have it in its own AppDomain.

Thank you much for any comments !!

Best regards
Frank Uray
Jul 21 '08 #1
2 1922
On Mon, 21 Jul 2008 08:55:01 -0700, Frank Uray
<Fr*******@discussions.microsoft.comwrote:
[...]
Now I have new a timer which should do this calling,
but of corse the timer runs in another thread then MDI Container Form.
When I now call it, the new form loads but it is frozen ... :-(((
Without a concise-but-complete code sample, it's impossible to know for
sure. However, I suspect that the issue has nothing to do with the
AppDomain. Rather, it's probably just because you have no message pump in
the thread that created the form.

You can solve that either by showing the form with the Application.Run()
method, or by making sure that the code that actually creates the form is
executed on the thread that already has a message pump (i.e. your main GUI
thread, assuming you have one).

Pete
Jul 21 '08 #2
This definately sounds like a problem with the fact there is no message pump
on thread that makes the form. Test this by using a
System.Windows.Forms.Timer so the form is made on the main UI thread. It this
fixes the problem but you want the form to be made in a background thread to
keep responsiveness in the Main form while it does, call Application.Run on
the new form to setup a message pump for it.

--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Peter Duniho" wrote:
On Mon, 21 Jul 2008 08:55:01 -0700, Frank Uray
<Fr*******@discussions.microsoft.comwrote:
[...]
Now I have new a timer which should do this calling,
but of corse the timer runs in another thread then MDI Container Form.
When I now call it, the new form loads but it is frozen ... :-(((

Without a concise-but-complete code sample, it's impossible to know for
sure. However, I suspect that the issue has nothing to do with the
AppDomain. Rather, it's probably just because you have no message pump in
the thread that created the form.

You can solve that either by showing the form with the Application.Run()
method, or by making sure that the code that actually creates the form is
executed on the thread that already has a message pump (i.e. your main GUI
thread, assuming you have one).

Pete
Jul 22 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Richard P | last post by:
I need some help on timers. My app is asp.net 1.1 website running in a shared hosting environment with a third-party service provider. I currently request and cache 20 - 40 remote RSS feeds. When a...
4
by: Hagay Lupesko | last post by:
Hi, I've encountered a strange phenomena which appears to me as a bug: I have an engine that uses a System.Threading.Timer to invoke a delegate every X minutes. The code looks something...
2
by: hnkien | last post by:
Hi, I am writing a windows service with threading.timer for 10 seconds but it didn't work. Here are my code: namespace SchedulerService { public class ScheduleService :...
5
by: Dave | last post by:
I trying to setup a time. The following code is in a function, Timer stateTimer = new Timer(ab(), null, 1000, 1000); I have included using System.Threading; at the begining of my code....
4
by: Naveen Mukkelli | last post by:
Hi, Currently I'm using System.Threading.Timer to perform some tasks periodically, lets say every minute. How can we disable this timer(System.Threading.Timer) so that the time spent in the...
2
by: steve | last post by:
Since System.Threading.Timer uses the threadpool to do its stuff what happens when (a) You try to create a timer and the thread pool is *exhausted* (b) The timer is due to fire AND all threads...
19
by: adi | last post by:
Hi I need the following: at particular times of day, I want to make some processing. System.Windoes.Timer doesn't help much, because it exposes the Interval property. Instead, I need to tell...
10
by: DaTurk | last post by:
Hi, I'm creating an application that will need to use a timer to do a static method call every second. My question, is what would be the best timer to use? I know there are several, but I'd...
11
by: Anil Gupte/iCinema.com | last post by:
When I use this Dim instance As New Timer I get the error: Error 1 Overload resolution failed because no accessible 'New' accepts this number of arguments. Yet, in the help section for...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.