Ejemplo n.º 1
0
        static void Main()
        {
            FireAlarm myFireAlarm = new FireAlarm();

            FireAlarmHandler handler = new FireAlarmHandler(myFireAlarm);

            EventArgs e = new EventArgs();

            //lansare evenimente
            myFireAlarm.SunaAlarma(e);

            Console.Read();
        }
Ejemplo n.º 2
0
        static void Main()
        {
            FireAlarm myFireAlarm = new FireAlarm();

            FireAlarmHandler handler = new FireAlarmHandler(myFireAlarm);

            FireAlarmEventArgs e1 = new FireAlarmEventArgs("Camera 1", 3);
            FireAlarmEventArgs e2 = new FireAlarmEventArgs("Camera 2", 7);

            //lansare evenimente
            myFireAlarm.SunaAlarma(e1);
            myFireAlarm.SunaAlarma(e2);

            Console.Read();
        }
Ejemplo n.º 3
0
 //definire constructor
 public FireAlarmHandler(FireAlarm alarma)
 {
     //abonare metoda proprie la eveniment
     alarma.FireAlarmEvent += new FireAlarm.FireAlarmActionDelegate(this.DoSomething);
 }