static void Main(string[] args) { EventGenerator generator = new EventGenerator(); generator.GeneratorEvent += new EventHandler(generator_GeneratorEvent); generator.StartGenerate(); Console.ReadLine(); }
static void generator_GeneratorEvent(object sender, EventArgs e) { EventGenerator g = sender as EventGenerator; if (g != null & g.GenerationCount == 0) { g.GenerationCount = EVENTCOUNTER; } Console.WriteLine("Got Event!"); }