Timer
Timer Example ; Auto Fire after 3 seconds...........................
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Text;
using System.Timers;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private System.Timers.Timer timer;
private int counter = 0;
public Form1()
{
InitializeComponent();
timer = new System.Timers.Timer();
timer.Elapsed += timer_Elapsed;
timer.Interval = (1000 * 3);
timer.Start();
}
void timer_Elapsed(object sender, ElapsedEventArgs e)
{
counter = counter + 1;
timer.Stop();
MessageBox.Show(counter.ToString());
timer.Start();
}
}
}
http://www.codeproject.com/Tips/480049/Shut-Down-Restart-Log-off-or-Lock-your-computer-in
No comments:
Post a Comment