Beispiel #1
0
 public void regTrigAft(string eventName, SyncTrigger trigger)
 {
     if (!_triggerLinkDict.TryGetValue(getAftTimeName(eventName), out var list))
     {
         list = new LinkedList <SyncTrigger>();
         _triggerLinkDict.Add(getAftTimeName(eventName), list);
     }
     list.AddLast(trigger);
 }
Beispiel #2
0
 public bool unregTrigAft(string eventName, SyncTrigger trigger)
 {
     if (_triggerLinkDict.TryGetValue(getAftTimeName(eventName), out var list))
     {
         return(list.Remove(trigger));
     }
     else
     {
         return(false);
     }
 }
        public void doTriggerTest()
        {
            SyncTriggerSystem system  = createSystem();
            float             f       = 0;
            SyncTrigger       trigger = new SyncTrigger(
                g1 => f += 1,
                g1 => f += 1);

            system.doTrigger(trigger);
            Assert.AreEqual(2, f);
        }
        public void regGetUnregTest()
        {
            SyncTriggerSystem system = createSystem();

            Assert.AreEqual(0, system.getTrigBfr("Test").Count());
            Assert.AreEqual(0, system.getTrigAft("Test").Count());
            SyncTrigger t1 = new SyncTrigger();
            SyncTrigger t2 = new SyncTrigger();

            system.regTrigBfr("Test", t1);
            system.regTrigAft("Test", t2);
            Assert.AreEqual(1, system.getTrigBfr("Test").Count());
            Assert.AreEqual(t1, system.getTrigBfr("Test").First());
            Assert.AreEqual(1, system.getTrigAft("Test").Count());
            Assert.AreEqual(t2, system.getTrigAft("Test").First());
            system.unregTrigBfr("Test", t1);
            system.unregTrigAft("Test", t2);
            Assert.AreEqual(0, system.getTrigBfr("Test").Count());
            Assert.AreEqual(0, system.getTrigAft("Test").Count());
        }
Beispiel #5
0
 public SyncTask doTrigger(SyncTrigger trigger)
 {
     return(doTask(trigger.actions));
 }