CAB实现 MBS

fmms 13年前
     <p>MBS 重新设计和实现了 CAB (Composite UI Application Block) 同时集成了消息总线、IoC 以及 UI 插件。</p>    <p>消息总线的例子:</p>    <p>1. string of message content<br /> var MB = new MessageBus();//create message bus<br /> var unsubscriber = MB.Subscribe((s,e)=>Console.WriteLine(e));//subscribe the string of message content<br /> MB.Publish("hello Message Bus!");//public the string of message content<br /> unsubscriber.Dispose();//un subscribe<br /> <br /> 2. int type of message<br /> var MB = new MessageBus();//create message bus<br /> var unsubscriber = MB.Subscribe((s,e)=>Console.WriteLine(e));//subscribe int message type<br /> MB.Publish(521);//publish<br /> unsubscriber.Dispose();//unsubscribe<br /> <br /> 3. User defined Message<br /> public class Person<br /> {<br /> public string Name { get;set;}<br /> public int Age { get;set;}<br /> public bool Sex { get;set;}<br /> } <br /> <br /> var MB = new MessageBus();//create message bus<br /> var unsubscriber = MB.Subscribe((s,e)=>Console.WriteLine(e.Name));// subscribe Persion Message (the output is Persion.Name)<br /> MB.Publish(new Person { Name = "ZhangSan"});//publish Person Message<br /> unsubscriber.Dispose();//unSubscribe<br /> <br /> <br /> </p>    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1327494918468" target="_blank">http://www.open-open.com/lib/view/home/1327494918468</a></p>