Scheduled execution program elapsedeventargs

Source: Internet
Author: User

In addition to standard eventargs members, the elapsedeventargs class exposes a common signaltime attribute, which contains a precise time when the timer time slice disappears.

Private Static void timeevent (Object source, elapsedeventargs E)
{
// Get hour minute second. If it is equal to a value, execute Program .
Int inthour = E. signaltime. hour;
Int intminute = E. signaltime. minute;
Int intsecond = E. signaltime. Second;
// Customize the time. For example, execute a function.
Int ihour = 10;
Int iminute = 30;
Int isecond = 00;
// Set the execution to start once every second
If (intsecond = isecond)
{
Console. writeline ("the execution starts once every second! ");
}
// Set the execution to start 30 minutes each hour
If (intminute = iminute & intsecond = isecond)
{
Console. writeline ("the execution starts once every 30 minutes! ");
}

// Set the program to start running at 10:30:00 every day
If (inthour = ihour & intminute = iminute & intsecond = isecond)
{
Console. writeline ("Run at every day! ");
}
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.