473,491 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Events, Remoting, Threads and UIs

I am doing some work a distributed application, which uses events and
remoting to accomplish the signaling between applications. This all works.

The problem I have (I think) is that since remoting/events essentially
guarantees that you are working in a multi-threaded environment, the
developer of the application that consumes these events, if they intend on
using these events to update a UI, has to understand delegates and invokes.
Maybe that is not too much to ask, but, it would certainly be nice if that
was hidden from them.

I would like to create a little event class, that hides all the
implementation details of the remoting and events, so they simply have to
instantiate the class and tie their event handlers to my exposed events.

So, I have thought about it, but can't come up with an answer. Is there
anyway I can have my "event" class have the event handlers that the user
writes run on the same thread as the thread in which they were attached, so
the person writing the event handlers only has to care about threading
issues that they cause, not ones that my system causes...
Nov 16 '05 #1
1 2267
This isn't quite as graceful as I'm sure you're hoping for, but one
possibility is to do what the System.Timers.Timer object does: provide a
SynchronizingObject property which is of type ISynchronizeInvoke. Let the
client app set this property to the form which will be catching the events.
When your events arrive, invoke the event delegate using the Invoke() method
of the object they give you -- that should put the call on the correct
thread. If there's no synchronizing object, just raise the event on the
current thread.

Ken
"Bruce M. Carroll" <br***@celticlords.com> wrote in message
news:es**************@TK2MSFTNGP09.phx.gbl...
I am doing some work a distributed application, which uses events and
remoting to accomplish the signaling between applications. This all works.
The problem I have (I think) is that since remoting/events essentially
guarantees that you are working in a multi-threaded environment, the
developer of the application that consumes these events, if they intend on
using these events to update a UI, has to understand delegates and invokes. Maybe that is not too much to ask, but, it would certainly be nice if that
was hidden from them.

I would like to create a little event class, that hides all the
implementation details of the remoting and events, so they simply have to
instantiate the class and tie their event handlers to my exposed events.

So, I have thought about it, but can't come up with an answer. Is there
anyway I can have my "event" class have the event handlers that the user
writes run on the same thread as the thread in which they were attached, so the person writing the event handlers only has to care about threading
issues that they cause, not ones that my system causes...

Nov 16 '05 #2

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

Similar topics

0
1265
by: Leo Tohill | last post by:
In our IIS application we have C# "behind code" that calls across remoting to a service. In the service, we keep local storage on the thread. From instrumentation, I now realize that hundreds of...
0
1690
by: jan v | last post by:
Hi everyone I have a problem with events. When the code reaches communication.SynchronisationServer.UpdateNotificationEvent+=new...
3
4184
by: Yair | last post by:
Hi, After executing a server-client remoting scheme I wrote, I've noticed a constant memory growth (both at the server, and at the client). Searching through various newsgroups, I've stumbled...
8
1401
by: wobbles | last post by:
Hi Everybody, How do I go about listening to events published by other apps? I know that my events are working internally (ie within my client), but when I subscribe to an event published by a...
2
5846
by: wobbles | last post by:
Hi Everyone (Happy New Year!), If I have clients that want to tell the server that something has happened, what would be the difference between "remoting events" and using an asynchronous (one...
9
8653
by: Michael Lindsey | last post by:
I need to write a server app to send images to client GUIs that are outside of the server's domain. The client will have the file system path to the image but can not access the file system. I am...
4
2104
by: Frank | last post by:
Hello. In the early stages of developing a server application that will be required to send events to multiple client applications that will be running on different PC's. I'm wondering what the...
1
1850
by: Antimon | last post by:
Hi, I have a single threaded server application except for async socket methods. Anyway, i need to host some remote objects but remoting mechanism spawns new threads for remote calls. I don't...
1
1674
by: Dilip | last post by:
I have a peculiar problem that I am not sure how to solve. I have a C# application that has 2 appdomains. The default appdomain just exposes a remoting end point that external applications can...
0
7112
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7146
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6852
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7356
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5448
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4878
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
277
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.