The Easy way to add TriggerHandlers by the BUNDLE.

Creating a Library starts with creating a class that inherits from AbstractBaseLibrary.
public class TestLibrary : AbstractBaseLibrary{

}
In the constructor of this TestLibrary would be where the TriggerHandlers are added. This happens through the Add method. Add takes a minimum of 3parameters, the Trigger you want to handle and the TriggerHandler followed by a optional description of the trigger. Hint: Its good practice to add a comment with a description of the trigger for easier debugging purposes. Monkeyspeak also goes a step further by giving you informative Exceptions when a exception is raised by a Trigger by giving you the Library class followed by the TriggerHandler method name and the Trigger identifier, always (#:#).
public class TestLibrary : AbstractBaseLibrary{
        public TestLibrary(){
            // (0:0) when someone does something,
            Add(TriggerType.Cause, 0, WhenSomeoneDoesSomething,
                "(0:0) when someone does something,");
        }

        private bool WhenSomeoneDoesSomething(TriggerReader reader){
            return EventManager.SomeoneDidSomething();
        }
}
Now the TestLibrary is complete. We have our TriggerHandler WhenSomeoneDoesSomething registered to TriggerType.Cause, 0 or Trigger (0:0) when someone does something, Now when you call GettingStarted it will look for the trigger (0:0) and call our handler WhenSomeoneDoesSomething.

Last edited May 5, 2012 at 4:33 AM by Squizzle, version 3

Comments

No comments yet.