注意:这一系列随笔都基于这个假设
--------
Prsim 提供了4中方式:Commanding,Event Aggregation,Region Context,Shared Services
Commanding
1,定义全局的 CompositeCommand,通常需要被定义在一个基础模块中,比如 MyApp.Infrastructure;
2,在View Model中定义一个 ICommand;
3,在View Model的构造函数中 RegisterCommand;
4,Binding 步骤1中的 CompositeCommand 到 GUI 上。当 GUI 触发 CompositeCommand 后,会调用所有的 RegisterCommand。
See also:
http://channel9.msdn.com/blogs/mtaulty/prism--silverlight-part-7-commands
Event Aggregation
1, 在 MyApp.Infrastructure 中定义 Event,比如 class MyEvent;
2, IEventAggregator.GetEvent<MyEvent>.Subscribe(Func);
3, IEventAggregator.GetEvent<MyEvent>.Publish(obj);
See Also:
http://channel9.msdn.com/blogs/mtaulty/prism--silverlight-part-8-loosely-coupled-events
Region Context
See Also:
http://channel9.msdn.com/blogs/mtaulty/prism--silverlight-part-9-sharing-data-with-region-contexts
Shared Services
--------
MSDN: http://msdn.microsoft.com/en-us/library/ff921122(v=PandP.40).aspx