123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- namespace EEMSMain;
- /// <summary>
- /// Interaction logic for App.xaml
- /// </summary>
- public partial class App : PrismApplication
- {
- protected override Window CreateShell()
- {
- return Container.Resolve<MainWindow>();
- }
- protected override void RegisterTypes(IContainerRegistry containerRegistry)
- {
- containerRegistry.Register<ICommonContainer, CommonContainer>();
- containerRegistry.RegisterSingleton<ContainerManager>();
- containerRegistry.RegisterSingleton<DeviceCollection>();
- }
- protected override IModuleCatalog CreateModuleCatalog()
- {
- return new DirectoryModuleCatalog() { ModulePath = Path.Combine(Environment.CurrentDirectory, "Modules") };
- }
- }
- public class CommonContainer(IRegionManager regionManager,
- IModuleManager moduleManager, ContainerManager containerManager) : ICommonContainer
- {
- private const string _MainReginName = "MainRegion";
- string ICommonContainer.MainReginName => _MainReginName;
- void ICommonContainer.AddModule(string name)
- {
- try
- {
- moduleManager.LoadModule(name);
- }
- catch
- {
- }
- }
- void ICommonContainer.AddNavigation(ContainerInfo containerInfo)
- {
- if (containerInfo.IsHidden)
- return;
- App.Current.Dispatcher.Invoke(() =>
- {
- containerManager.Containers.TryAdd(containerInfo.Index, containerInfo);
- });
- }
- void ICommonContainer.RequestNavigation(string name)
- {
- regionManager.RequestNavigate(_MainReginName, name);
- }
- }
|