A real time updating interface

B

Beorne

Hello, I'm a Java programmer and I'm new to C# (I've read something but
I've no real programming experience). I'm programming a form that
displays some data from an external source (i.e. a com port) ad
displays it. The updating cycle is about every second. The windows form
has a few controls.

In Java there is the swing Timer class that implements a worker thread
that is activated every n millisec and is synchronized with the
interface event threads. Is there something similar in C#? Any example?
Thank you very much.
 
B

Beorne

Brian said:
Beorne,

The System.Windows.Forms.Timer and System.Timers.Timer can both be
synchronized with the main UI thread.

Brian

How could I synchronize the Windows.Forms.Timer with the main UI
Thread?

Thanks!
 
B

Brian Gideon

Beorne said:
How could I synchronize the Windows.Forms.Timer with the main UI
Thread?

Thanks!

I wasn't very clear. Actually, the System.Windows.Forms.Timer is
always synchronized with the UI thread. The System.Timers.Timer can
either use the UI thread or a ThreadPool thread depending on how the
SynchronizingObject property is set.

Brian
 
B

Beorne

Brian said:
I wasn't very clear. Actually, the System.Windows.Forms.Timer is
always synchronized with the UI thread. The System.Timers.Timer can
either use the UI thread or a ThreadPool thread depending on how the
SynchronizingObject property is set.

Brian

The choiche is very simple, i'm developing on Compact Framework and
System.Timers.Timer is not supported.
Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top