Advertisement
wingman007

SnakeOOPFinal_Timer

Oct 27th, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace SnakeOOP1b
  8. {
  9.     public delegate void TimerEventHandler(object sender, EventArgs e);
  10.     class Timer
  11.     {
  12.         public event TimerEventHandler Tick;
  13.  
  14.         private void OnTick(EventArgs e)
  15.         {
  16.             if (Tick != null) {
  17.                 Tick(this, e);
  18.             }
  19.         }
  20.  
  21.         public void Start()
  22.         {
  23.             while(true){
  24.                 OnTick(EventArgs.Empty);
  25.                 System.Threading.Thread.Sleep(100);
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement