static void Main(string[] args) { AtomPlant ap = new AtomPlant(); State romania = new State("Romania", ap); State hungary = new State("Hungary", ap); ap.Operate(); }
static void Main(string[] args) { // event publisher AtomPlant ap = new AtomPlant(); // Subscriber #1 State romania = new State("Romania", ap); // Subscriber #2 State hungary = new State("Hungary", ap); // Publisher starts ap.Operate(); Console.ReadKey(); }
public State(string s, AtomPlant ap) { name = s; this.ap = ap; this.ap.Explosion += new EventHandler <MEventArgs>(ap_Explosion); }
public State(string s, AtomPlant ap) { name = s; this.ap = ap; this.ap.Explosion += handleExplosionEvent; }