|
|
Or you might have wrong proxy address in the config file.
|
|
|
|
|
Greetings,
My question is: how is using EventsHelper.FireAsync() different from using EventsHelper.Fire() BUT having the listener's event handler spawn a new thread to do the work?
In my program, I have a data feed coming in and I have a separate form that has a DataGridView on it. Each time a message comes in (they come in very rapidly) I fire an event and the handler (which exists on the DataGridView's form) adds a row to the DataGridView.
Approach #1: use EventsHelper.FireAsync() to fire the events as they come in. This is nice because the slowness of adding rows to the DataGridView control doesn't slow down the incoming data feed AT ALL -- meaning, if there were other listeners to this event, their performance wouldn't suffer from the slow DataGridView. HOWEVER, this approach doesn't work because of the asynchronous nature, the rows aren't necessarily added in order (message 3 might be processed/added to the DataGridView before messages 1 and 2).
Approach #2: use EventsHelper.Fire() (the synchronous version), and in the event handler, spawn a BackgroundWorker that adds the message to the DataGridView. I don't like this approach because then EVERY handler of this event is going to have to do all this extra work, but I figured it was the only way I could ensure the messages (events) would be received in order. However what I noticed is this approach (spawning the BackgroundWorker thread) doesn't really give a speed improvement over simply doing ALL the work in the same event thread.
Why isn't approach #2, with a BackgroundWorker in the ONLY event handler as fast as approach #1?
I love the speed EventsHelper.FireAsync provides, but I need to maintain order of the events. If anyone has any advice, I'm all ears.
Thanks in advance!
RL
|
|
|
|
|
Well, I can only guess what EventsHelper is, but if I were to use my psychic debugging skills, I'd guess we're talking about something that calls delegates/events asynchronously.
To answer your question, my guess would be that EventsHelper.FireAsync may use a single background thread, whereas having the handlers each have their own has many threads. Just a wild guess though.
Here's what I recommend. When the data feed comes in, don't fire your event. Instead, have a queue, and every time data comes in, queue up a function that raises the event or actually updates the data, whatever you need it to do.
Combine that with Application.Idle event handler. This handler should check the queue for any queued up stuff, and if so, execute it. That way, you'll never flood your UI thread with the incoming data, the DataGridView will remain responsive, and you'll get your data in the correct order.
|
|
|
|
|
HI,
i Have An APP that when u want to save something
i like to show the user these field's :
Auther,Description (like u got in windows)
Can i Create A File(The Format for now is .txt)
And Set his Properies of Auther,Description
And if so How?
A link would be Usfull (THANKS)
Have Fun
Never forget it
|
|
|
|
|
Try this : http://www.codeproject.com/cs/files/detailedfileinfo.asp
I am fighting against the Universe...
Reference-Rick Cook
|
|
|
|
|
THANKS
But I stiil trying To figure how to create the file and it's Properies
I'm Tring Assembly, is it the right way ?
Have Fun
Never forget it
|
|
|
|
|
Hello everyone,
I am currently using Visual Studio 2005 Express Edition. I would like to get my hands on Visual Studio 2005 Standard Edition. If I am not mistaken there should be a Trial Version available. I have been searching and searching and searching but unfortunatly, I am unable to find the Trial Version online.
Can anyone tell me where I can find a Trial Version of Visual Studio 2005 Standard Edition?
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
I don't know anything about it but it seems possible that the Express Edition is the trial edition, yes?
|
|
|
|
|
The Express Edition is not a trial edition. Its free .(and = 0).
I am fighting against the Universe...
Reference-Rick Cook
|
|
|
|
|
Hello,
Thanx for the respond. Yes, the Express Edition is the Free one, but surly, the Standard Edition should have a Trial Edition. After all the Profesional Edition has a 90Days Trial period.
Thank you again and have a great day.
Khoramdin
|
|
|
|
|
Khoramdin wrote: the Standard Edition should have a Trial Edition.
not sure what you mean by "should". They have what the have, period. I would imagine that if you can't find it anywhere it doesn't exist. It's not like you're looking for something produced by a guy out of his garage.
|
|
|
|
|
Hello Mike,
What can I say! You are correct! Thank for your help, mate.
Have a great day
Khoramdin
|
|
|
|
|
You can't find it because there is no time-limited trial version for Standard or Pro Editions. There is only a trial version of the Team Suite Edition, found here[^].
|
|
|
|
|
Hello Dave,
Thanx mate.
Have a great day.
Khoramdin
|
|
|
|
|
How to connect hardware device to my C# program , such as Camera , or any device (connect by port)
CS
|
|
|
|
|
About the only answer anyone can give you, because there is no detail in the question, is that you would normally talk to the device using it's device driver.
There is no one method for any and all devices. Each device has it's own rules and methods for communicating with it.
|
|
|
|
|
i like to connect a camera with my C# program , how can i do it
im begginer in C#
thanks for u
CS
|
|
|
|
|
If you have a driver, the camera probably appears as a removable USB drive. You can find lots of information about how to detect and access one of them if you Google it.[^]
If you don't have a driver one will need to be written first. You cannot do this in C#, it must be done in C/C++. Writing a driver is *not* an easy task, nor is it something that can be done by a beginning level programmer.
--
Help Stamp Out and Abolish Redundancy
The preceding is courtesy of the Department of Unnecessarily Redundant Repetition Department.
|
|
|
|
|
Do you want to be more specific about what exactly you're doing with the camera?? What kind of camera?? Is it attached USB?? Do you have drivers?? Are you trying to get a "live" image from the camera?? Are you just downloading images stored in the camera?? Does it show up as a "USB Storage Device" in Explorer??
Or should we just leave it at the less-than-meager explanation you've given and drop the whole idea?? I repeat - The quality (read: detail) of the question you ask is DIRECTLY responsible for the quality of the answer you get.
|
|
|
|
|
I am writeing windows service that makes use in MSMQ in .net 2003 in c#.
I user the method beginPeek(TimeSpan) and waiting for an message to arrive
the event handler look like this:
private void MyPeekCompleted(Object source,
PeekCompletedEventArgs asyncResult)
{
try
{
// End the asynchronous peek operation.
Message m = _mq.EndPeek(asyncResult.AsyncResult);
//logic to handel message
mq.BeginPeek(new TimeSpan(0,1,0));
}
catch(MessageQueueException e)
{
if (e.MessageQueueErrorCode ==
MessageQueueErrorCode.IOTimeout)
{
Console.WriteLine(e.ToString());
}
_mq.BeginPeek(new TimeSpan(0,1,0));
}
catch(Exception ex)
{
// some code to handel error
}
after a while i get stackoverflow exception. event though no message arrives...
It works fike for a couple of minuts and than crushes..
How can i solve this..
Sample code will be greate help..
im using winXP
Thnks
|
|
|
|
|
Hi,
I have no experience in this, but I see a logical problem in your code.
the MSDN example has BeginPeek as the last statement in the PeekCompleted handler.
Yours has more than one BeginPeek, and they are not at the end, so if they complete
before you have left the Completed handler (Console.WriteLine will take some msecs),
a new one would be launched before the current one exits, consuming stack space.
Hope this helps.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
yhanks for the
I dont understnd what you mean
can you pleas wexplain again
|
|
|
|
|
Mire over i have 2 begin peek because i have to continue waiting for a message
one begin peek is in call if no exception and the other if an exception happen so
they will never happen at the same time
|
|
|
|
|
Hi,
this is my suggestion: remove the BeginPeeks you have, and put a single
mq.BeginPeek(new TimeSpan(0,1,0));
as the very last line of the PeekCompleted handler.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|