public void OnFireEvent(EFireCategory fireCategory)
        {
            FireAlarmEventArgs fe = new FireAlarmEventArgs(fireCategory);

            if (FireEvent != null)
                FireEvent(this, fe);
        }
Esempio n. 2
0
        public void OnFireEvent(EFireCategory category)
        {
            FireAlarmEventArgs fe = new FireAlarmEventArgs(category);

            if (FireEvent != null)
                FireEvent(this, fe);
        }
        public void OnFire(EFireSeriousness fireSeriousness)
        {
            FireAlarmEventArgs fireEventArgs = new FireAlarmEventArgs(fireSeriousness);

            if (FireEvent != null)
                FireEvent(this, fireEventArgs);
        }
Esempio n. 4
0
 //definire functie starter a evenimentului
 public void SunaAlarma(FireAlarmEventArgs e)
 {
     if (FireAlarmEvent != null)
     {
         //se apeleaza evenimentul
         FireAlarmEvent(this, e);
     }
 }
Esempio n. 5
0
        public void onFireEvent(EFireCategory fCat)
        {
            FireAlarmEventArgs fe = new FireAlarmEventArgs(fCat);

            if (FireEvent != null)
            {
                FireEvent(this, fe);
            }
        }
Esempio n. 6
0
        public void OnFireEvent(EFireCategory fireCategory)
        {
            FireAlarmEventArgs fe = new FireAlarmEventArgs(fireCategory);

            //Check to make sure event cannot be triggered while event contains null data
            if(FireEvent != null){
                //Call fire event, giving it itself as an object argument and the passed-in fire severity as an argument.
                FireEvent(this,fe);
            }
        }
Esempio n. 7
0
        public void onFireEvent(EFireCategory fCat)
        {
            //Create new custom event args using supplied category
            FireAlarmEventArgs fe = new FireAlarmEventArgs(fCat);

            //Check there is a observer registed or system will crash
            if (FireEvent != null)
            {
                FireEvent(this, fe);
            }
        }
Esempio n. 8
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();
        }
Esempio n. 9
0
 //definire metoda pentru abonare la eveniment
 public void DoSomething(object sender, FireAlarmEventArgs e)
 {
     if (e.risc < 5)
     {
         Console.WriteLine("Alarma incendiu in camera " +
                           e.camera + ". Contactati telefonic camera. " +
                           "Posibil tigara aprinsa!");
     }
     else
     {
         Console.WriteLine("Alarma incendiu in camera " +
                           e.camera + ". Contactati departamentul pompieri. " +
                           "Evacuati cladirea!");
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Method that is executed when event is fired
 /// </summary>
 /// <param name="fireSubject">Subject that fired event</param>
 /// <param name="fe">Event arguments</param>
 public override void FireAlarmHandlerMethod(object fireSubject, FireAlarmEventArgs fe)
 {
     switch (fe.FireCategory)
     {
         case EFireCategory.MINOR:
             Beep(200, 1000);
             break;
         case EFireCategory.SERIOUS:
             Beep(400, 1000);
             break;
         case EFireCategory.INFERNO:
             Beep(800, 1000);
             break;
     }
 }
Esempio n. 11
0
 public override void FAHM(object fireSubject, FireAlarmEventArgs fe)
 {
     switch (fe.FireCategory)
     {// beeps commented out . getting dll not found error
         case EFireCategory.MINOR:
             //Beep(800, 500);
             break;
         case EFireCategory.SERIOUS:
             //Beep(1000, 500);
             break;
         case EFireCategory.INFERNO:
             //Beep(1200, 500);
             break;
     }
 }
Esempio n. 12
0
 /// <summary>
 /// Method that is executed when event is fired
 /// </summary>
 /// <param name="fireSubject">Subject that fired event</param>
 /// <param name="fe">Event arguments</param>
 public override void FireAlarmHandlerMethod(object fireSubject, FireAlarmEventArgs fe)
 {
     String message = "Fire is " + fe.FireCategory.ToString() + ". ";
     switch (fe.FireCategory)
     {
         case EFireCategory.MINOR:
             message += "Use a fire extinguisher.";
             break;
         case EFireCategory.SERIOUS:
             message += "Call the Fire Department.";
             break;
         case EFireCategory.INFERNO:
             message += "Evacuate immediately!!!!!";
             break;
     }
     MessageBox.Show(message);
 }
Esempio n. 13
0
        public override void FireAlarmHandlerMethod(object fireSubject, FireAlarmEventArgs fe)
        {
            switch (fe.FireCategory)
            {
            case EFireCategory.MINOR:
                Beep(800, 1000);
                break;

            case EFireCategory.SERIOUS:
                Beep(2000, 1000);
                break;

            case EFireCategory.INFERNO:
                Beep(4000, 1000);
                break;
            }
        }
Esempio n. 14
0
 public override void FireAlarmHandlerMethod(object fireSubject, FireAlarmEventArgs fe)
 {
     int duration = 1000;
     int frequency = 0;
     switch (fe.FireCategory)
     {
          case EFireCategory.MINOR:
             frequency = 500;
             break;
         case EFireCategory.SERIOUS:
             frequency = 800;
             break;
         case EFireCategory.INFERNO:
             frequency = 1000;
             break;
     }
     Beep(frequency, duration);
 }
        public override void HandlerMethod(object fireObject, FireAlarmEventArgs fe)
        {
            String message = "Fire is " + fe.FireCategory.ToString() + ",";

            switch(fe.FireCategory)
            {
                case EFireCategory.MINOR:
                    message += " use a fire extinguster.";
                    break;
                case EFireCategory.SERIOUS:
                    message += " call the Fire Fepartment.";
                    break;
                case EFireCategory.INFERNO:
                    message += "Evacuate Immediately.";
                    break;
            }

            MessageBox.Show(message);
        }
Esempio n. 16
0
        public override void FireAlarmHandlerMethod(object fireSubject, FireAlarmEventArgs fe)
        {
            String message = "Fire is " + fe.FireCategory.ToString() + ". ";

            switch (fe.FireCategory)
            {
            case EFireCategory.MINOR:
                message += "Use a fire extinguisher";
                break;

            case EFireCategory.SERIOUS:
                message += "Call the fire department";
                break;

            case EFireCategory.INFERNO:
                message += "Evacuate Immediately";
                break;
            }
            MessageBox.Show(message);
        }
Esempio n. 17
0
        //Override the base classes method with this one.
        public override void FireAlarmEventHandler(object fireSubject, FireAlarmEventArgs fe)
        {
            String result = "Fire is " + fe.FireCategory.ToString() + ".";

            //Switch on the fire category. This is possible due to having an enum.
            switch (fe.FireCategory)
            {
                //Case determines which text is appended to the end of the string
                case EFireCategory.MINOR:
                    result += "Use a fire extinguisher.";
                    break;
                case EFireCategory.SERIOUS:
                    result += "Call the Fire Department.";
                    break;
                case EFireCategory.INFERNO:
                    result += "IT'S OVER THERE IS NO HOPE";
                    break;
            }

            MessageBox.Show(result);
        }
Esempio n. 18
0
        public override void FireAlarmHandler(Object o, FireAlarmEventArgs fireEventArgs)
        {
            int beepFrequency;

            switch (fireEventArgs.FireSeriousness)
            {
                case EFireSeriousness.MINOR:
                    beepFrequency = 200;
                    break;
                case EFireSeriousness.SERIOUS:
                    beepFrequency = 440;
                    break;
                case EFireSeriousness.VERY_SERIOUS:
                    beepFrequency = 700;
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            Beep(beepFrequency, BEEP_LENGTH);
        }
Esempio n. 19
0
        public override void FireAlarmHandler(Object o, FireAlarmEventArgs fireEventArgs)
        {
            String message = "Fire is a " + fireEventArgs.FireSeriousness.ToString() + " fire. ";

            switch (fireEventArgs.FireSeriousness)
            {
                case EFireSeriousness.MINOR:
                    message += "Use an extinguisher.";
                    break;
                case EFireSeriousness.SERIOUS:
                    message += "Call 111.";
                    break;
                case EFireSeriousness.VERY_SERIOUS:
                    message += "Check the spider is dead, then call 111";
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            MessageBox.Show(message);
        }
Esempio n. 20
0
        public override void HandlerMethod(object fireObject, FireAlarmEventArgs fe)
        {
            String message = "Fire is " + fe.FireCategory.ToString() + ",";

            switch (fe.FireCategory)
            {
            case EFireCategory.MINOR:
                message += " use a fire extinguster.";
                break;

            case EFireCategory.SERIOUS:
                message += " call the Fire Fepartment.";
                break;

            case EFireCategory.INFERNO:
                message += "Evacuate Immediately.";
                break;
            }

            MessageBox.Show(message);
        }
Esempio n. 21
0
        public override void FireAlarmHandlerMethod(object fireSubject, FireAlarmEventArgs fe)
        {
            int freq     = 0;
            int duration = 1000;

            switch (fe.FireCategory)
            {
            case EFireCategory.MINOR:
                freq = 800;
                break;

            case EFireCategory.SERIOUS:
                freq = 1200;
                break;

            case EFireCategory.INFERNO:
                freq = 2000;
                break;
            }
            Beep(freq, duration);
        }
Esempio n. 22
0
 public abstract void FireAlarmHandler(Object o, FireAlarmEventArgs fireEventArgs);
 public abstract void FireAlarmHandlerMethod(object fireSubject, FireAlarmEventArgs fe);
 public abstract void FireAlarmHandlerMethod(object fireSubject, FireAlarmEventArgs fe);