Closed MikeAlhayek closed 6 years ago
Please provide a running sample that replicates the issue. There is not enough information here to help. I don't know what your shell looks like, what's in the shell, how the MainView gets in the shell or when. It sounds like your MainView doesn't exist at the time you fire the event, which is why it will work if you manually resolve then object. You may have a design issue.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Description
When my app first starts, I want to require the user to login. Once logged in, I want to show the default landing page with the user name and buttons.
My thought, when a user login, I would publish an event called
UserLoggedIn
then on the home view-model, I would listen for that event. When the event is triggered, I would show the landing/home view.So I created the event like so
Then in the
LoginViewModel
I handle the login and publish the event like soHere is how I configure my IoC continer in the Bootstrapper class
Here is also how I register the modules from the bootstrapper class
Finally in my
HomeViewModel
aka my landing view, I have the following code to listen for theUserLoggedIn
event.Problem is that the
ShowTheLangingPage
method never get triggered in myHomeViewModel
as expected.I made sure the the View
HomeView
andHomeViewModel
are wired up correctly, by directly loading theHomeView
on module initialization for testing.Additionally, if add
Container.Resolve<HomeView>();
just before I publish the event, theShowTheLangingPage
I called. Its like I have to resolve theHomeView
manually for it to listen for the event.Is this a bug? Is not, what am I doing wrong that is preventing the listener from firing? Not, my login process takes place in my
LoginModule
while theHomeView
is in a different module calledLandingModule
Steps to Reproduce
LoginModule : IModule
class add the following code to show the login at start upHandleLogin
(from above)HomeViewModel
above.