/// <summary> /// Default constructor /// </summary> private CarWrapper() { CoreBuilder coreBuilder = CoreBuilder.GetInstance(); this.ICarMgr = coreBuilder.GetManager <ICarMgr>(CoreBuilder.ICARMGR); this.ITransportMgr = coreBuilder.GetManager <ITransportMgr>(CoreBuilder.ITRANSPORTMGR); this.IEventMgr = coreBuilder.GetManager <IEventMgr>(CoreBuilder.IEVENTMGR); }
private void InitAdditionalService() { if (ServiceMgr.Current != null) { _eventMgr = ServiceMgr.Current.GetInstanceNoEx <IEventMgr>(); _logger.Debug("AdditionalServices: IEventMgr = {0}.", _eventMgr.ToStateString()); } }
public void Run() { _logMgr = CreateLogMgr(); if (_logMgr == null) { throw new NullReferenceException("LogMgr can not be null."); } _logger = _logMgr.GetLogger("BootStrapper"); _logger.Info("Run."); AggregateCatalog catalog = CreateAgregateCatalog(); if (catalog == null) { FatalError(new NullReferenceException("AggregateCatalog can not be null.")); } _container = new CompositionContainer(catalog); if (_container == null) { FatalError(new NullReferenceException("CompositionContainer can not be null.")); } IEventMgr eventMgr = CreateEventMgr(); if (eventMgr == null) { FatalError(new NullReferenceException("EventMgr can not be null.")); } PlugginMgr plugginMgr = CreatePlugginMgr(); if (plugginMgr == null) { FatalError(new NullReferenceException("PlugginMgr can not be null.")); } _container.ComposeExportedValue <ILogMgr>(LogMgr); _container.ComposeExportedValue <IEventMgr>(eventMgr); _container.ComposeExportedValue <IServiceMgr>(new ServiceMgrImpl(_logMgr, _container)); IServiceMgr serviceMgr = _container.GetExportedValue <IServiceMgr>(); ServiceMgr.SetServiceMgrProvider(() => serviceMgr); _container.ComposeExportedValue <IPlugginMgr>(plugginMgr); _container.ComposeParts(plugginMgr); RegisterServices(); StartWork(); }
private void InitCoreService() { IDbConnection dbConnection = new OraConnection(); CompositionContainer.ComposeExportedValue <IDbConnection>(dbConnection); _dbMgr = new OraDBMgr(dbConnection, LogMgr); CompositionContainer.ComposeExportedValue <IDbMgr>(_dbMgr); _settingMgr = new SettingMgr(LogMgr); _settingMgr.ReadWriteProvider = new OraDBSettingReadWriter(_dbMgr, LogMgr); CompositionContainer.ComposeExportedValue <ISettingMgr>(_settingMgr); _regionMgr = new RegionMgr(LogMgr); CompositionContainer.ComposeExportedValue <IRegionMgr>(_regionMgr); int firstMenuIndex = 2; BarCommandRegion mainMenuRegion = new BarCommandRegion(RegionName.MainMenu, _mainForm.MainMenu, firstMenuIndex); _regionMgr.AddCommandRegion(RegionName.MainMenu, new MainMenuCommandRegionDecorator(RegionName.MainMenu, mainMenuRegion)); _regionMgr.AddCommandRegion(RegionName.PlugginMenuItem, new SubMenuCommandRegionDecorator(RegionName.PlugginMenuItem, mainMenuRegion, _mainForm.PlugginBarButtonItem)); int firstToolBarIndex = 2; BarCommandRegion toolBarRegion = new BarCommandRegion(RegionName.MainToolBar, _mainForm.MainToolBar, firstToolBarIndex); _regionMgr.AddCommandRegion(RegionName.MainToolBar, toolBarRegion); IViewRegion documentRegion = new DocumentViewRegion(RegionName.DocumentRegion, _mainForm.MainDocumentManager, _mainForm.MainDockManager, LogMgr); _regionMgr.AddViewRegion(RegionName.DocumentRegion, documentRegion); IViewRegion dockPanelRegion = new DockingViewRegion(RegionName.DockPanelRegion, _mainForm.MainDocumentManager, _mainForm.MainDockManager, LogMgr); _regionMgr.AddViewRegion(RegionName.DockPanelRegion, dockPanelRegion); IViewFormMgr viewFormMgr = new ViewFormMgr(_mainForm, _mainForm.MainTaskBar, LogMgr); CompositionContainer.ComposeExportedValue <IViewFormMgr>(viewFormMgr); IMessageBoxMgr messageBoxMgr = new MessageBoxMgr(_mainForm, LogMgr, null, typeof(MainWaitForm)); CompositionContainer.ComposeExportedValue <IMessageBoxMgr>(messageBoxMgr); _plugginMgr = ServiceMgr.Current.GetInstance <IPlugginMgr>(); _eventMgr = ServiceMgr.Current.GetInstance <IEventMgr>(); }
public Pluggin(IServiceMgr serv, IEventMgr ev) : base() { }