Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;

            EventBus.Instance.Subscribe(new OrderAddedEventHandler_SendEmail());
            var entity = new OrderGeneratorEvent {
                OrderID = 1
            };

            Console.WriteLine("生成一个订单,单号为:{0}", entity.OrderID);
            EventBus.Instance.Publish(entity);

            Console.Read();
        }
Exemplo n.º 2
0
        public void SubscribeTest()
        {
            EventBus.Instance.Subscribe(new OrderAddedEventHandler_SendEmail());
            EventBus.Instance.Subscribe(new OrderAddedEventHandler_Todo());

            var entity = new OrderGeneratorEvent {
                OrderID = 1
            };

            Console.WriteLine("生成一个订单,单号为{0}", entity.OrderID);
            //EventBus.Instance.Publish(entity);



            Action <OrderGeneratorEvent, bool, Exception> sdf = (e, flog, ex) => { Console.WriteLine("q的值:" + flog); };

            EventBus.Instance.Publish(entity, sdf);
        }
 public void Handle(OrderGeneratorEvent tEvent)
 {
     System.Console.WriteLine(string.Format("{0}的下单红包已发送", tEvent.OrderId));
 }