Beispiel #1
0
        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>();
        }
Beispiel #2
0
 private void OnApplicationQuit()
 {
     _instance = null;
 }