Prism: EventAggregator and MEF - 2 different instances of EventAggregator

I have the following setup:

  • Silverlight app divided into xaps / modules
  • I use MEF as a DI framework to connect various parts of my application.

  • I have 2 areas:

  • One (left) is populated with a list view (for example, clients)

  • One (right) view is populated containing a tabcontrol with the region that I inhabited (according to which the client is selected) with another view containing a tab control with an area.

    Result of the right side: enter image description here

To populate the first level tabcontrol, I listen to the “modified client event” - (this works fine), and when I receive the event, I populate the “First level” tab with “Views”:

    Dim lReg As IRegion = Me.mRegionManager.Regions("FirstLevelTabReqion")
    Dim lViewID As String = CommonDefinitions.Constants.BuildFirstLevelViewName(lUniqueID)
    Dim lFirstLevelView FirstLevelView = TryCast(lReg.GetView(lRqViewID), FirstLevelView)
    If lFirstLevelView Is Nothing Then     
         lFirstLevelView = New FirstLevelView()
         Dim lRegMan1 As IRegionManager = lReg.Add(lFirstLevelView, lViewID, True)
         lFirstLevelView.SetRegionManager(lRegMan1)
         ...
    End If

. FirstLevelView CompositionInitializer.SatisfyImports, , FirstLevelView ViewModel.

EventAggregator ModelMeel SecondLevel, :

  <ImportingConstructor()>
  Public Sub New(ByVal iEvAggregator As IEventAggregator)
          EventAggregator = iEvAggregator
          EventAggregator.GetEvent(Of DoStuffSecondLevel).Subscribe(AddressOf OnDoStuffSecondLevel, True)

   End Sub

, EventAggregator, , EventAggregator , , DoStuffSecondLevel , .

2 EventAggregator?
, EventAggregator ?

+5
1

, MefBootstrapper , DEFAULT. SatisfyImports, MEF , . , 2 . , Prism Container MEF.

Silverlight Solution ( ):

protected override void InitializeShell()
{
    base.InitializeShell();

    //Make the container the default one.
    CompositionHost.Initialize(this.Container);

    //Etc.
}

WPF (Desktop) :

. , MEF ExportFactory<T> ComponentInitializer Silverlight (Why!?). Glen Block , System.ComponentModel.Composition.Initialization.dll. , , , ... , ? MEF2 (Codeplex preview) , , (). , MEF2 (Codeplex), Prism .NET 4 MEF Codeplex MEF2. Prism Codeplex MEF2 . , WPF.

+3

All Articles