Indicates the runtime model of the dynamic route when the current process is used.

Source: Internet
Author: User
The following is a preliminary model for using a specific procedure to determine the time limit for a row.

Using System;

Using System. Data;

Using System. Threading;

Using System. Windows. forms;


Namespace Win

{

/**/ /// <Summary>

///Run once every 30 minutes

/// </Summary>

Public   Class Timer

{

/**/ /// <Summary>Running?</Summary>

Public   Bool Brun;

/**/ /// <Summary>Maximum number of outgoing records</Summary>

Public   Int Icount = 10 ;


Public Timer ()

{

Brun =   False ;

// Used only for outgoing route

Thread mythread =   New Thread ( New Threadstart (runtimer ));

Mythread. Start ();

}


/**/ /// <Summary>

///Waiting time and waiting time

/// </Summary>

Private   Void Runtimer ()

{

Int Curm = Int32.parse (datetime. Now. Minute. tostring ());

If (Curm = 0   | Curm = 30 ) &&   ! Brun)

{< br>
Brun = true ;< br>
thread = New thread ( New threadstart (runmethod);
thread. start ();

}

Else

{



If (Curm > 30 )

Curm =   60 - Curm;

Else

Curm =   30 - Curm;

MessageBox. Show (curm. tostring ());

Thread. Sleep (curm * 60 * 1000 );

Runtimer ();

}

}


/**/ /// <Summary>

///Time-based row Creation Method

/// </Summary>

Private   Void Runmethod ()

{

Int Irun =   0 ;

Try

{

MessageBox. Show (datetime. Now. tostring ());

Brun= False;

Runtimer ();

}

Catch

{

If(Irun<Icount) runmethod ();

ElseMessageBox. Show ("System FAQs");

}

Finally

{

Irun++;

}

}




}

}

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.