示例#1
0
        public void WireUpListeners()
        {
            // Listen to an 'under the covers' system event
            Dispatch.Listen(EventName.OnException, ExampleListener);

            // All of our internal stuff uses the broadcast system so we'll listen on exception and rethrow.
            // TODO: Does this hide the info? Is there any benefit to throwing it from the offending method/call?
            Dispatch.Listen(EventName.OnException, FireOnException);

            //Dispatch.Listen(NotificationEvents.OnNotificationAddSubScriber, ExampleListener);
            Dispatch.Listen(OnWriteAuditTrailToDisk, ExampleListener);

            // Look at the concept of 'Echo'. We can setup a filter that will get call for all events. This is helpful for Audit and Notification subsystems.
            Dispatch.Echo((response) => { Console.WriteLine("Echo out every message: {0}", response.Message); });
        }