473,386 Members | 1,699 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,386 software developers and data experts.

Raising Asynchronous Events from Components

I have a multi-threaded class that I am creating that needs needs to raise
events when certain asynchronous events occur. I would always like the
events to be raised to the primary UI thread of any application that is using
my component. I can't just call raiseevent from the thread that catches the
asynchronous data. (In this case from a serial port). This is because I
have a separate thread reading from the serial device. How can I marshall
the call such the event is raised on the primary UI thread?

My only solution right now is to use a Form Timer in the class and
repeatedly poll the thread to see if any events should be raised. Is there a
better way?
Nov 21 '05 #1
2 1555
This sounds very promising. Thanks for the info. I couldn't access the
project you said you were attaching. Can you try to attach it again. I
would really like to see it.

Thanks,
John

"Charles Law" wrote:
Hi John

Have a look at ISynchronizeInvoke. The attached project shows how you can
use it to do what you are asking.

HTH

Charles
"TrtnJohn" <Tr******@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.com...
I have a multi-threaded class that I am creating that needs needs to raise
events when certain asynchronous events occur. I would always like the
events to be raised to the primary UI thread of any application that is
using
my component. I can't just call raiseevent from the thread that catches
the
asynchronous data. (In this case from a serial port). This is because I
have a separate thread reading from the serial device. How can I marshall
the call such the event is raised on the primary UI thread?

My only solution right now is to use a Form Timer in the class and
repeatedly poll the thread to see if any events should be raised. Is
there a
better way?


Nov 21 '05 #2
Doh, I am using IE to view the board. I was hoping for a link to download
from :(
"Charles Law" wrote:
I have attached it again but with a txt extension in case your newsreader is
blocking zip files. Save and rename it with a zip extension and away you go.

Charles
"TrtnJohn" <Tr******@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.com...
This sounds very promising. Thanks for the info. I couldn't access the
project you said you were attaching. Can you try to attach it again. I
would really like to see it.

Thanks,
John

"Charles Law" wrote:
Hi John

Have a look at ISynchronizeInvoke. The attached project shows how you can
use it to do what you are asking.

HTH

Charles
"TrtnJohn" <Tr******@discussions.microsoft.com> wrote in message
news:D7**********************************@microsof t.com...
>I have a multi-threaded class that I am creating that needs needs to
>raise
> events when certain asynchronous events occur. I would always like the
> events to be raised to the primary UI thread of any application that is
> using
> my component. I can't just call raiseevent from the thread that
> catches
> the
> asynchronous data. (In this case from a serial port). This is because
> I
> have a separate thread reading from the serial device. How can I
> marshall
> the call such the event is raised on the primary UI thread?
>
> My only solution right now is to use a Form Timer in the class and
> repeatedly poll the thread to see if any events should be raised. Is
> there a
> better way?


Nov 21 '05 #3

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

Similar topics

1
by: john bailo | last post by:
Suppose I am writing a program that has to execute as series of steps, but at several of the steps, I want to wait for external events to occur. For example ( and this relates to another of my...
3
by: David | last post by:
Hi, Ive been trying to work this out for the past 2 days now and im not getting anywhere fast. The problem i have is that i am using Asynchronous sockets to create a Socket Client library....
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
1
by: Natalia DeBow | last post by:
Hi, I am working on a Windows-based client-server application. I am involved in the development of the remote client modules. I am using asynchronous delegates to obtain information from...
4
by: rawCoder | last post by:
Hi all, How Can You Raise Events Asynchronously ? Now for the details ... I want to do inter modular communication using events in such a way that the contributing modules need not...
7
by: cider123 | last post by:
I'm coding a project using the following article as reference: http://www.codeproject.com/csharp/DynamicPluginManager.asp In this type of project, plugins are loaded dynamically into a Plugin...
2
by: VBTricks.de.vu Webmaster | last post by:
Hello everybody, I need to write a HTTP client capable of downloading files using the HTTP protocoll. But downloading is one of my problems. I'm new to VB.net and I know there's a framework...
4
by: Dave A | last post by:
I am developing a somewhat complex component at the moment and coincidently I am also reading the Framework Design Guidelines book. After reading the section about event raising I have re-written...
2
by: Gman | last post by:
Hi, I have created a usercontrol, a grid control essentially. Within it I have a class: clsGridRecord. I have coded the events such that when a user clicks on the grid, say, the events occur on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.