Actually, in .NET, you're only supposed to raise events within the same class. See:
http://stackoverflow.com/questions/7903 ... in-c-sharphttp://stackoverflow.com/questions/4378 ... in-c-sharpBesides the hacks shown in some answers above, you have two options. One is to switch from using an event to using a property whose type is the same as the delegate. The other is to provide a public method that raises the event like so:
sig UpdateHandler
interface IView
event finishedUpdate as UpdateHandler
class X implements IView
event finishedUpdate as UpdateHandler
def raiseFinishedUpdate
raise x.finishedUpdate
class MyProgram
def main
x = X()
x.raiseFinishedUpdate
But note that in most C# code I see, the method to raise an event is not public. Instead, events are raised from within the class to notify listeners when something interesting has happened for that class and object. Putting the logic for raising an event outside the class might be the event-based analog of "spaghetti code". So really the code should look more like:
sig UpdateHandler
interface IView
event finishedUpdate as UpdateHandler
class X implements IView
event finishedUpdate as UpdateHandler
def update
# do some update stuff
# and then:
raise x.finishedUpdate
class MyProgram
def main
x = X()
x.update
Also, note that I suffixed the sig name with "Handler". This is a common .NET style for declaring sigs/delegates that will be used for events.
I'll look into improving the Cobra compiler error checking and message.