static void Main() { Timer timer = new Timer(); Subscriber sub = new Subscriber(); sub.Subscribe(timer); timer.RepeatWithDelegate(Subscriber.PrintNote, 1, 5); }
public void Subscribe(Timer time) { time.RaiseCustomEvent += new Timer.ExecuteRepeatedlyPrintDelegate(PrintNote); }
public static void PrintNote(Timer time, EventArgs e) { Console.ForegroundColor = ConsoleColor.Green; Console.Write('\u266B' + " "); Console.ForegroundColor = ConsoleColor.White; }