473,796 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A real time updating interface

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.

Oct 17 '06 #1
5 3156

Beorne wrote:
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.
If you're using .NET 2.0 I suggest you take a look at BackgroundWorke r
(http://msdn2.microsoft.com/en-us/lib...undworker.aspx)
If you don't like this approach, or, want to accomplish this by your
own hand (to improve your knowledge about C# and .NET) take a look at
this very simple example
http://dotnetjunkies.com/WebLog/bben...29/137586.aspx.
The examples above may give you an introduction to the subject.

HTH

Oct 17 '06 #2

Beorne wrote:
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.
Beorne,

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

Brian

Oct 17 '06 #3

Brian Gideon wrote:
Beorne wrote:
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.

Beorne,

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

Brian
How could I synchronize the Windows.Forms.T imer with the main UI
Thread?

Thanks!

Oct 27 '06 #4

Beorne wrote:
Brian Gideon wrote:
Beorne,

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

Brian

How could I synchronize the Windows.Forms.T imer 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.T imer can
either use the UI thread or a ThreadPool thread depending on how the
SynchronizingOb ject property is set.

Brian

Oct 27 '06 #5

Brian Gideon wrote:
Beorne wrote:
Brian Gideon wrote:
Beorne,
>
The System.Windows. Forms.Timer and System.Timers.T imer can both be
synchronized with the main UI thread.
>
Brian
How could I synchronize the Windows.Forms.T imer 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.T imer can
either use the UI thread or a ThreadPool thread depending on how the
SynchronizingOb ject property is set.

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

Oct 30 '06 #6

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

Similar topics

22
1154
by: MJR | last post by:
Hi, just wondering what options I would have if I wanted to use Python to produce real-time graphs. Is there any plotting package suitable for this. Thanks, Mike
18
12599
by: Ken | last post by:
Hi. Can anyone refer me to any articles about the compatibility between c++ polymorphism and real-time programming? I'm currently on a real-time c++ project, and we're having a discussion about whether we should allow polymorphism. Our system is not embedded and does not need to be as real-time as, say, a pacemaker. But it does involve updating displays based on radar input. So a need for something close to real-time is desired...
12
6565
by: Russ | last post by:
I'm interested in setting up a web page where live data can be displayed in real-time on the web page. For example: I would like to display a (nice looking) graph of some data value versus time and have the graph update every second without the user having to do anything like hit a refresh button. The data to plot is readily available from an application running on the server - I can expose it in whatever way is needed (currently easily...
175
8910
by: Ken Brady | last post by:
I'm on a team building some class libraries to be used by many other projects. Some members of our team insist that "All public methods should be virtual" just in case "anything needs to be changed". This is very much against my instincts. Can anyone offer some solid design guidelines for me? Thanks in advance....
2
1965
by: Colli | last post by:
Hi: I need to setup a continuously updating system Date/Time in my user interface. I can get the system date/time and can cause it to update with a button-click but I can't seem to figure out how to cause it to update continuously (as it does in the bottom right corner of my desktop). Can anyone help me with this. Please E-Mail me directly with your advsce. Thanks. Colli From...
34
3191
by: Guch Wu | last post by:
Boost has many terrific libraries. But I want to know whether they are ready for using in real projects. Which of them are mature enough, or just only in progress?
10
3089
by: Martin Hughes | last post by:
Hi guys, I was wondering if anyone could give me some advice. I am looking to develop an ASP.NET application that will enable several workstations to access real time telemetry data received from a vehicle on a track. The data flow would be as follows: |-- Workstation 1
15
2633
by: (PeteCresswell) | last post by:
Some time within the next nine months, there's a pretty good chance I'll have the "opportunity" to port a bond trading system that I wrote - whose front end is currently MS Access - to .NET. Quotes bc I need this like I need another hole in the head. But in the words of one of my esteemed colleagues: "I don't sell programming; I sell happiness." And if this will make my clients happy, that's what floats my boat in the long run.
2
1745
by: Blubaugh, David A. | last post by:
To All, I have done some additional research into the possibility of utilizing Python for hard real time development. I have seen on various websites where this has been discussed before on the internet. However, I was wondering as to how successful anyone has truly been in developing a program project either in windows or in Linux that was or extremely close to real time constraints? For example is it possible to develop a python...
0
10452
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10169
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9050
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
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 we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.