TestModule.cs 929 B

1234567891011121314151617181920212223242526272829
  1. using Test.ViewModels;
  2. using Test.Views;
  3. using UICommon.CommonContainer;
  4. namespace Test;
  5. [Module(ModuleName = nameof(TestModule), OnDemand = false)]
  6. public class TestModule : IModule
  7. {
  8. public TestModule(ICommonContainer commonContainer)
  9. {
  10. commonContainer.AddModule(nameof(TestModule));
  11. commonContainer.AddNavigation(new(0, "Test", nameof(TestPage), true, null!));
  12. }
  13. public void OnInitialized(IContainerProvider containerProvider)
  14. {
  15. IRegionManager regionManager = containerProvider.Resolve<IRegionManager>();
  16. ICommonContainer commonContainer = containerProvider.Resolve<ICommonContainer>();
  17. regionManager.RegisterViewWithRegion(commonContainer.MainReginName, typeof(TestPage));
  18. }
  19. public void RegisterTypes(IContainerRegistry containerRegistry)
  20. {
  21. containerRegistry.RegisterForNavigation<TestPage, TestPageViewModel>(nameof(TestPage));
  22. }
  23. }