コード例 #1
0
        //private bool spent = false;

        internal TriggerManager(Trigger trigger, IMastAdapter mastInterface)
        {
            if (trigger == null)
            {
                throw new NullReferenceException("Trigger must not be null.");
            }
            if (mastInterface == null)
            {
                throw new NullReferenceException("IMastAdapter must not be null.");
            }

            Trigger = trigger;
            MastInterface = mastInterface;

            foreach (Condition c in trigger.startConditions)
            {
                ConditionManager cm = new ConditionManager(c, MastInterface);
                //We need to wire up events, for event type conditions, and this is also used for some property calculations around time
                //if (c.type == ConditionType.@event) {
                cm.EventFired += new EventHandler(OnConditionEventFired);
                //}
                StartConditions.Add(cm);
            }

            foreach (Condition c in trigger.endConditions)
            {
                ConditionManager cm = new ConditionManager(c, MastInterface) { IsEndCondition = true };
                //if (c.type == ConditionType.@event) {
                cm.EventFired += new EventHandler(OnConditionEventFired);
                //}
                EndConditions.Add(cm);
            }

            //we just need this for 'per clip' events, to reset the flag
            //ReflectionHelper.AttachEvent(MastInterface, "OnItemEnd", this, "OnItemEnd");
        }
コード例 #2
0
 /// <summary>
 /// Deserializes workflow markup into an Trigger object
 /// </summary>
 // <param name="xml">string workflow markup to deserialize</param>
 // <param name="obj">Output Trigger object</param>
 // <param name="exception">output Exception value if deserialize failed</param>
 // <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out Trigger obj, out System.Exception exception)
 {
     exception = null;
     obj = null;
     try
     {
         System.IO.StringReader stringReader = new System.IO.StringReader(xml);
         System.Xml.XmlReader xmlTextReader = System.Xml.XmlReader.Create(stringReader);
         System.Xml.Serialization.XmlSerializer xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(Trigger));
         obj = ((Trigger)(xmlSerializer.Deserialize(xmlTextReader)));
         return true;
     }
     catch (System.Exception e)
     {
         exception = e;
         return false;
     }
 }
コード例 #3
0
 internal TriggerFailureEventArgs(Trigger Trigger, Exception Exception)
     : base(Trigger)
 {
     exception = Exception;
 }
コード例 #4
0
 internal TriggerEventArgs(Trigger Trigger)
 {
     trigger = Trigger;
 }