MainModule.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using LogoForceTestApp.Modules.MainModule.Views;
  2. using LogoForceTestApp.Services;
  3. using LogoForceTestApp.Core;
  4. using Prism.Ioc;
  5. using Prism.Modularity;
  6. using Prism.Regions;
  7. using StatementMachineService.Core;
  8. using AutoMapper;
  9. using LogForceTestApp.Modules.MainModule;
  10. using AutoMapper.EquivalencyExpression;
  11. using LogoForceTestApp.Modules.MainModule.Services;
  12. namespace LogoForceTestApp.Modules.MainModule
  13. {
  14. public class MainModule : IModule
  15. {
  16. private readonly IRegionManager _regionManager;
  17. public MainModule(IRegionManager regionManager, IMapper mapper)
  18. {
  19. _regionManager = regionManager;
  20. }
  21. //启动时 page
  22. public void OnInitialized(IContainerProvider containerProvider)
  23. {
  24. _regionManager.RequestNavigate(RegionNames.ContentRegion, "MainPage", c =>
  25. {
  26. });
  27. }
  28. public void RegisterTypes(IContainerRegistry containerRegistry)
  29. {
  30. containerRegistry.RegisterSingleton<InovanceTcp>();
  31. containerRegistry.RegisterDialog<OeeDialogPage>();
  32. containerRegistry.RegisterForNavigation<OperationLogPage>();
  33. containerRegistry.RegisterForNavigation<MainPage>();
  34. containerRegistry.RegisterForNavigation<LogPage>();
  35. containerRegistry.RegisterForNavigation<DataPage>();
  36. containerRegistry.RegisterForNavigation<LoginPage>();
  37. containerRegistry.RegisterForNavigation<OeeDebugPage>();
  38. containerRegistry.RegisterForNavigation<ParamPage>();
  39. containerRegistry.RegisterForNavigation<QualityTracing>();
  40. containerRegistry.RegisterForNavigation<SignInPage>();
  41. containerRegistry.RegisterSingleton<IStateService, StateService>();
  42. containerRegistry.RegisterSingleton<IScanService, ScanService>();
  43. containerRegistry.RegisterSingleton<IWarningUpdateService, WarningUpdateService>();
  44. var configuration = new MapperConfiguration(cfg =>
  45. {
  46. cfg.AddCollectionMappers();
  47. cfg.AddProfile(new MainModuleProfile());
  48. });
  49. containerRegistry.RegisterInstance(typeof(IMapper), new Mapper(configuration));
  50. }
  51. }
  52. }