Call function at certian interval of time

  • Thread starter Thread starter Materialised
  • Start date Start date
M

Materialised

Hi Everyone,

I am developing a application for my personal use. Basically what it
will do is grab still images from my webcam at a set interval of time.
And save them to me hard disk. The program then uploads the files to my
ftp server for inclusion on my website.

This part is all working fine, however, what I want to do next is upload
all photos created in the (for this purpose lets say) past hour (which
can be user defined), to a different directory on the ftp server, for
archive purposes. Now the upload isn't a issue, but I am unsure of how
to approach the performing of the upload at a certian interval of time
as provided by the user.
Obviously it would require some sort of timer to enable me to do this,
but I am totally new to C#.

I am not asking for people to write the code for me, I am just looking
for general idea on how to accomplish what I want.

I anticipate your responses

Regards
 
I'm assuming this is a winforms app? Under the All Windows Controls tab in
the toolbox is a Timer control. Set the time interval to number of
milliseconds (i.e. 5 seconds = 5000 milliseconds) and tie the timer event to
a method in your form (or generate a new timer event method) and away you
go!

Robert
 
n4ixt said:
I'm assuming this is a winforms app? Under the All Windows Controls tab in
the toolbox is a Timer control. Set the time interval to number of
milliseconds (i.e. 5 seconds = 5000 milliseconds) and tie the timer event to
a method in your form (or generate a new timer event method) and away you
go!

Robert
Hi Robert,

Thanks for your reply.

A while back I used to do some VB 6 work, before migrating to C on Unix
platforms, and if I recall correctly, the VB timer control was limited
to a certain relatively small frame of time. Is this the case with the
..net timer control? As rather than periods of milliseconds I am looking
to work over periods of hours.

Kind Regards
 
Hi Materialised,

Since your interval period is so large, I can think of three options
that you can consider :

1. Use the System.Timers.Timer component (located on the Components tab
of the Toolbox) and not the System.Windows.Forms.Timer component. The
former is an enhanced version of the VB 6.0 control. It does not have
the same limitations that the latter does.

2. Derive your own Timer from the Timer class, improvising it to suit
your particular needs.

3. Search for a free Timer control on the net :
This article on Codeproject explains how to build one -
http://www.codeproject.com/dotnet/ABTransClockArticle.asp

I also found the following article which explains how to use the
standard timer in a large interval time frame.

http://searchvb.techtarget.com/tip/1,289483,sid8_gci553801,00.html?FromTaxonomy=/pr/4f0

Hope this information helps,

Regards,

Cerebrus.
 
Cerebrus said:
Hi Materialised,


Since your interval period is so large, I can think of three options
that you can consider :

1. Use the System.Timers.Timer component (located on the Components tab
of the Toolbox) and not the System.Windows.Forms.Timer component. The
former is an enhanced version of the VB 6.0 control. It does not have
the same limitations that the latter does.

2. Derive your own Timer from the Timer class, improvising it to suit
your particular needs.

3. Search for a free Timer control on the net :
This article on Codeproject explains how to build one -
http://www.codeproject.com/dotnet/ABTransClockArticle.asp

I also found the following article which explains how to use the
standard timer in a large interval time frame.

http://searchvb.techtarget.com/tip/1,289483,sid8_gci553801,00.html?FromTaxonomy=/pr/4f0

Hope this information helps,

Regards,

Cerebrus.
Thanks for your reply Cerebrus, I will look into all the options and let
you know how I get one.

Once again thank you.

Kind Regards
Materialised
 

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

Back
Top