Events are not triggered through modules (prism, MVVM, silverlight C #)

That's right, and now I believe that I installed this application correctly, but correct me if I'm wrong, just for the reason that I have 3 modules loaded in my boot module, one is a navigation module, and the other two are views.

Regardless of the code, if I load the modules in the initialization method, add them to the area in which everything works fine, but of course id, as some control.

Now in the navigation view model, I have an event aggregator that publishes an event (a class that inherits from EventArgs, if that matters), the other two modules subscribed to this event, but did not receive it,

/// <summary>
    /// Carries the out menu item selection methods.
    /// </summary>
    /// <param name="e">The <see cref="TMBL.Web.TMBLCore.Controls.Assets.NavigationViewSelectionEventArgs"/> instance containing the event data.</param>
    public void CarryOutMenuItemSelectionMethods(NavigationViewSelectionEventArgs e)
    {
        _eventAggregator.GetEvent<NavigationMenuItemSelectedEvent>().Publish(e);
    }

in navigation ViewModel and then subscribed to the news module

_eventAggregator.GetEvent<NavigationMenuItemSelectedEvent>().Subscribe(NavigationMenuReturnedEvent,
                                                                               ThreadOption.UIThread);

, , , , , ?

, viewsand view (, ). , , , , ,

_displayNewsView = new DisplayNewsView(new DisplayNewsViewModel(_eventAggregator));

viewmodels ?

+3
2

, .

1) . . .

2) NavigationMenuItemSelectionEvent , ? ( ), , . "" ( "" > " Windows" ). .

, , , , ​​..Net , NavigationMenuItemSelectionEvent .

, , , , ( , ).

+3

. , , . , , ? -, .

 protected override DependencyObject CreateShell()
    {
        _eventAggregator = new EventAggregator();
        var shell = Container.Resolve<Shell>();
        Application.Current.RootVisual = shell;
        return shell;
    }

? -, , , , ,

 protected override IModuleCatalog GetModuleCatalog()
    {
        var catalog = new ModuleCatalog();
        catalog.AddModule(typeof(TMBLCoreModule), InitializationMode.WhenAvailable);
        catalog.AddModule(typeof(NewsModule), InitializationMode.WhenAvailable);
        catalog.AddModule(typeof(UserModule), InitializationMode.WhenAvailable);
        return catalog;
    }

. google, havent ,

+1

Source: https://habr.com/ru/post/1770165/


All Articles