This project is read-only.

TriggerHandlerAttribute and you!

If you are not familiar with Attributes then read up on them
  • http://msdn.microsoft.com/en-us/library/z0w1kczw.aspx

First some basic rules to declaring a method with TriggerHandlerAttribute
  1. Class containing method can be Private or Public
  2. Method must be Public
  3. Method must take only 1 parameter the TriggerReader and nothing more
  4. Method must return bool (In VB function return type must be declared "As Boolean")

In C# you would declare a the method like so
class TestClass{
    [Monkeyspeak.TriggerHandler(TriggerCategory.Cause, 1000, "(0:1000 test cause we like tests,")]
    public bool TestMethod(TriggerReader reader){
        ...
        return true;
    }
}
In VB.Net
Class TestClass
    <Monkeyspeak.TriggerHandler(TriggerCategory.Cause, 1000, "(0:1000) test cause we like tests,")>
    Shared Function TestMethod(reader As TriggerReader) As Boolean ' <-- As Boolean must be declared
        ...
        Return True
    End Function
End Class

Load it into your Page by calling
page.LoadLibraryFromAssembly(string assemblyFile);

Last edited Jun 20, 2012 at 10:25 PM by Squizzle, version 3

Comments

Squizzle Jun 20, 2012 at 10:21 PM 
Yes in order to use the Monkeyspeak.TriggerHandlerAttribute you have to import Monkeyspeak namespace and reference Monkeyspeak.dll

Gerolkae Jun 20, 2012 at 8:50 PM 
for VB.Net does that included Imports MonkeySpeak?