Esempio n. 1
0
        // It	is	useful	if	subscribers	can	be	given information	about	the	alarm. You	can	do	this	by	creating	a	class	that
        // can	deliver	this	information	and	then use	an	EventHandler	to	deliver	it.
        public void EventHandlerData()
        {
            AlarmEventData alarmEventData = new AlarmEventData();

            alarmEventData.OnAlarmRaised += AlarmListenerData;
            alarmEventData.RaiseAnAlarm("Hello there!");
            // Note	that	a	reference	to	the	same	AlarmEventArgs	object	is	passed	to	each of	the	subscribers	to	the	OnAlarmRaised	event.
            // This	means	that	if	one	of	the subscribers	modifies	the	contents	of	the	event	description,	subsequent subscribers	will
            // see	the	modified	event.	This	can	be	useful	if	subscribers	need	to signal	that	a	given	event	has	been	dealt
            // with,	but	it	can	also	be	a	source	of unwanted	side	effects.
        }
Esempio n. 2
0
        //public void UpdateAlarmEventsTest()
        //{
        //    //AlarmSequenceListControlWPF.FreezeAllUpdates();

        //    long now = DateTime.Now.Ticks;
        //    int iter = 0;
        //    foreach (long alarmID in AlarmConfig.AlarmConfigs.Keys)
        //    {
        //        AlarmEventData l_AlarmEventData = new AlarmEventData();
        //        l_AlarmEventData.ID = alarmID;
        //        l_AlarmEventData.SessionID = 1;
        //        l_AlarmEventData.TimeIn = now;
        //        l_AlarmEventData.TimeOut = now;
        //        l_AlarmEventData.LastModified = now;
        //         AlarmEvents.UpdateAlarmEvent(l_AlarmEventData);
        //        iter++;
        //        if (iter >= 100)
        //        {
        //            break;
        //        }
        //    }

        //    //AlarmSequenceListControlWPF.ResumeAllUpdates();
        //}

        public void UpdateAlarmEvents()
        {
            //Debug.WriteLine("<<<<------------(UPDATE ALARM EVENTS)--------------->>>>");
            //Debug.WriteLine("<<<<------------(       START       )--------------->>>>");
            if (ProcessConnectionServer != null && m_AlarmEventDatas != null)
            {
                for (int iter = 0; iter < m_AlarmEventDatas.Length; iter++)
                {
                    AlarmEventData l_AlarmEventData = m_AlarmEventDatas[iter];
                    if (l_AlarmEventData != null)
                    {
                        //Debug.WriteLine(l_AlarmEventData);
                        AlarmEvents.UpdateAlarmEvent(l_AlarmEventData);
                    }
                }
            }
            //Debug.WriteLine("<<<<------------(       DONE        )--------------->>>>");
        }