Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading.Tasks;
- using System.Timers;
- namespace ConsoleApplication1
- {
- class Demo
- {
- static void Main()
- {
- Remind alarmSet = new Remind();
- alarmSet.CheckReminder();
- Console.ReadLine();
- }
- }
- public class Remind
- {
- private static int counterAlarms = 0;
- private double interval = 3000; // milliseconds
- public void CheckReminder()
- {
- Timer checkForTime = new Timer(interval);
- checkForTime.Elapsed += new ElapsedEventHandler(checkForTime_Elapsed);
- checkForTime.Enabled = true;
- }
- private void checkForTime_Elapsed(object sender, ElapsedEventArgs e)
- {
- Console.WriteLine(counterAlarms++);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement