private static void ChangeTriggerOnOff(EcasAction a, EcasContext ctx)
        {
            string strName = EcasUtil.GetParamString(a.Parameters, 0, true);
            uint   uState  = EcasUtil.GetParamUInt(a.Parameters, 1);

            EcasTrigger t = null;

            if (strName.Length == 0)
            {
                t = ctx.Trigger;
            }
            else
            {
                foreach (EcasTrigger trg in ctx.TriggerSystem.TriggerCollection)
                {
                    if (trg.Name == strName)
                    {
                        t = trg; break;
                    }
                }
            }

            if (t == null)
            {
                throw new Exception(KPRes.ObjectNotFound +
                                    MessageService.NewParagraph + KPRes.TriggerName + ": " + strName + ".");
            }

            if (uState == IdTriggerOn)
            {
                t.On = true;
            }
            else if (uState == IdTriggerOff)
            {
                t.On = false;
            }
            else if (uState == IdTriggerToggle)
            {
                t.On = !t.On;
            }
            else
            {
                Debug.Assert(false);
            }
        }
Пример #2
0
        public EcasContext(EcasTriggerSystem coll, EcasTrigger trigger,
                           EcasEvent e)
        {
            if (coll == null)
            {
                throw new ArgumentNullException("coll");
            }
            if (trigger == null)
            {
                throw new ArgumentNullException("trigger");
            }
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            m_coll     = coll;
            m_trigger  = trigger;
            m_eOccured = e;
        }