Skip to content

Instantly share code, notes, and snippets.

@DominicFinn
Created July 26, 2016 13:10
Show Gist options
  • Save DominicFinn/1787290f9f7f3ce42f56bb0cf46c184a to your computer and use it in GitHub Desktop.
Save DominicFinn/1787290f9f7f3ce42f56bb0cf46c184a to your computer and use it in GitHub Desktop.
Usage Example For Eventing https://github.com/DominicFinn/Eventing
public class Main
private _bus as IEventBus
public sub New(IEventBus bus)
_bus = bus
end sub
private Sub click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuSave.Click
_bus.publish(new SomethingHappened() with { .Id = 1 })
end sub
end class
public class SomethingHappened
public readonly Id as integer
public sub New(id as integer)
me.Id = id
end sub
end class
public class DoSomethingOnSomethingHappened
Implements IEventHandler(Of SomethingHappened)
sub handle(ByVal e As SomethingHappened) _
Implements IEventHandler(Of SomethingHappened).Handle
' do something with the something happened event, save an entity, create a project, send an email
End Sub
end class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment