Esempio n. 1
0
        //Events -------------------------------------------------------
        void myArea_ElkAreaEvent(object sender, ElkAreaEventArgs e)
        {
            switch (e.EventUpdateType)
            {
            case eElkAreaEventUpdateType.ArmedStatusChange:
                if (newArmedStatusChange != null)
                {
                    newArmedStatusChange((ushort)myArea.GetAreaArmedStatus);
                }
                break;

            case eElkAreaEventUpdateType.ArmUpStatChange:
                if (newArmUpStateChange != null)
                {
                    newArmUpStateChange((ushort)myArea.GetAreaArmUpState);
                }
                break;

            case eElkAreaEventUpdateType.AlarmStateChange:
                if (newAlarmStatusChange != null)
                {
                    newAlarmStatusChange((ushort)myArea.GetAlarmStatus);
                }
                break;

            case eElkAreaEventUpdateType.NameChange:
                if (newNameChange != null)
                {
                    newNameChange((SimplSharpString)myArea.GetAreaName);
                }
                break;

            case eElkAreaEventUpdateType.ClockChange:
                if (newClockChange != null)
                {
                    newClockChange((SimplSharpString)myArea.GetAlarmCountdownClockString);
                }
                break;

            case eElkAreaEventUpdateType.ZoneAssignmentChange:
                if (newZoneAssignmentChange != null)
                {
                    newZoneAssignmentChange();
                }
                break;
            }
        }
        private void ElkNotificationMessageHandler_ElkAreaEvent(object sender, ElkAreaEventArgs e)
        {
            if (!myElkNotificationManager.managerReady)
            {
                return;
            }
            ElkArea currentArea = myPanel.GetAreaObject(e.Area);
            string  areaName    = currentArea.GetAreaName.TrimEnd();

            switch (e.EventUpdateType)
            {
            case eElkAreaEventUpdateType.ArmedStatusChange:
                eAreaArmedStatus status = currentArea.GetAreaArmedStatus;

                string devicesToSendArmed = string.Join(",", CheckAreaNotificationProperty(currentArea, e.EventUpdateType));
                if (devicesToSendArmed.Length > 0 && !String.IsNullOrEmpty(devicesToSendArmed))
                {
                    PushoverManager.Instance.SendMessage(devicesToSendArmed, String.Format("{0} - {1}", areaName, status),
                                                         String.Format("Area {0}", status));
                    myPanel.SendDebug(
                        String.Format("NotificationMessageHandler: Building Message *{0} - {1} to Devices {2}",
                                      areaName, status, devicesToSendArmed));
                }
                break;

            case eElkAreaEventUpdateType.AlarmStateChange:
                eAreaAlarmState alarmStatus        = currentArea.GetAlarmStatus;
                string          devicesToSendAlarm = string.Join(",", CheckAreaNotificationProperty(currentArea, e.EventUpdateType));
                if (devicesToSendAlarm.Length > 0 && !String.IsNullOrEmpty(devicesToSendAlarm))
                {
                    PushoverManager.Instance.SendMessage(devicesToSendAlarm, String.Format("{0} - {1}", areaName, alarmStatus),
                                                         String.Format("Area {0}", alarmStatus));
                    myPanel.SendDebug(
                        String.Format("NotificationMessageHandler: Building Message *{0} - {1} to Devices {2}",
                                      areaName, alarmStatus, devicesToSendAlarm));
                }
                break;
            }
        }