Multiple instances of a specific module #2367
-
Description An example of this would be an instance [A] of a "Link Module", that would contain a certain collection of website links, and another instance [B] that is also a "Link Module", that would contain a different set of links. Issue Github repo for demo project The problem can be recreated by clicking the "Generic View" card to open the main window and then try to navigate between "Internal Links" and "External Links". The view is not updated with the correct data. Basic Information: Information to quickly navigate the solution Projects:
Project setup: ModuleInstancesTest.ApplicationShell App.xaml.cs I am overriding InitializeModules() to iterate and load each module instance. The modules are specified in a data service with dummy data, i.e. links. In the InitializeModules() method I also use the "_containerRegistry.RegisterInstance" to register a specific viewmodel that I later inject in my MainLinkCollectionViewModel located in the LinkCollectionModule project. Debugging the the project shows that the injection works fine. So far so good. ModuleInstancesTest.Module.LinkCollectionModule LinkCollectionModule.cs Here I first add my views to my "navigation" regions. Then I register the MainLinkCollectionView with the MainWindowRegion, which is the region where the links should be presented.
In this file I also register my view (MainLinkCollectionView) with a unique name (the name is a GUID formatted as a string and is the same name as the module) for navigation. I also register the associated viewmodel (MainLinkCollectionViewModel) and inject the correct data.
NavItemLinkCollectionViewModel This class contains a method for navigating to the specific view. Here I can see that the ModuleName variable is correct and should correspond to the:
...in the LinkCollectionModule , but the view is not updated with the correct viewmodel.
Any ideas of what I might do wrong here? :) /Peter |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This app is extremely overcomplicated. There is a lot of improvements that need to be made and a lot of code that needs to be simplified. This would require a complete architecture review and restructure. Unfortunately, this falls outside the level of community support I provide and would require the use of my paid services. |
Beta Was this translation helpful? Give feedback.
This app is extremely overcomplicated. There is a lot of improvements that need to be made and a lot of code that needs to be simplified. This would require a complete architecture review and restructure. Unfortunately, this falls outside the level of community support I provide and would require the use of my paid services.