void ExtinguishFire(object sender, FireEventArgs fe) { Console.WriteLine("\nThe ExtinguishFire function was called by {0}.", sender.ToString()); if (fe.ferocity < 2) { Console.WriteLine("This fire in the {0} is no problem. I'm going to pour some water on it.", fe.room); } else if (fe.ferocity < 5) { Console.WriteLine("I'm using FireExtinguisher to put out the fire in the {0}.", fe.room); } else { Console.WriteLine("The fire in the {0} is out of control. I'm calling the fire department!", fe.room); } }
public void ActivateFireAlarm(string room, int ferocity) { FireEventArgs fireArgs = new FireEventArgs(room, ferocity); FireEvent(this, fireArgs); }