Beispiel #1
0
        protected override void InitInternal()
        {
            IServiceMgr serviceMgr = ServiceMgr.Current;

            _regionMgr = serviceMgr.GetInstance <IRegionMgr>();

            IDbAccessor dbSccessor = new DbAccessor();

            _mainController = new MainController(dbSccessor);
            serviceMgr.AddInstance <IRequestService>(_mainController);

            _plugginMenuCommand = new RequestPlugginMenuCommand();

            _requestListCommand         = new RequestListCommand(_mainController);
            _requestCreateCommand       = new RequestCreateCommand(_mainController);
            _requestPeriodReportCommand = new RequestPeriodReportCommand(_mainController);

            _plugginMenuCommandKey = _regionMgr.GetCommandRegion(RegionName.PlugginMenuItem).AddCommand(_plugginMenuCommand);

            _plugginMenuRequestListCommandKey = _regionMgr.GetCommandRegion(RegionName.PlugginMenuItem).AddCommand(_requestListCommand, _plugginMenuCommand.Name);
            _mainToolBarRequestListCommandKey = _regionMgr.GetCommandRegion(RegionName.MainToolBar).AddCommand(_requestListCommand);

            _plugginMenuRequestCreateCommandKey = _regionMgr.GetCommandRegion(RegionName.PlugginMenuItem).AddCommand(_requestCreateCommand, _plugginMenuCommand.Name);
            _mainToolBarRequestCreateCommandKey = _regionMgr.GetCommandRegion(RegionName.MainToolBar).AddCommand(_requestCreateCommand);

            _plugginMenuPeriodReportCommandKey = _regionMgr.GetCommandRegion(RegionName.PlugginMenuItem).AddCommand(_requestPeriodReportCommand, _plugginMenuCommand.Name);
            _mainToolBarPeriodReportCommandKey = _regionMgr.GetCommandRegion(RegionName.MainToolBar).AddCommand(_requestPeriodReportCommand);

            _eventMgr = serviceMgr.GetInstance <IEventMgr>();

            Subscribe();
        }
Beispiel #2
0
        static void Main()
        {
            Bootstrapper boot = new Bootstrapper();

            boot.Run();

            IServiceMgr serviceMgr = ServiceMgr.Current;
            IPlugginMgr plugMgr    = serviceMgr.GetInstance <IPlugginMgr>();
            ILogMgr     logMgr     = serviceMgr.GetInstance <ILogMgr>();
            ILogger     logger     = logMgr.GetLogger("Main");

            serviceMgr.AddInstance <ILogger>(logger);

            foreach (IPluggin plug in plugMgr.Pluggins)
            {
                logger.Info(plug.Name);
            }

            serviceMgr.Trace();
            ILogger l = serviceMgr.GetInstance <ILogger>();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
        internal RequestPlugginMenuCommand()
        {
            IServiceMgr serviceMgr = ServiceMgr.Current;

            _logMgr = serviceMgr.GetInstance <ILogMgr>();
            _logger = _logMgr.GetLogger("RequestPlugginMenuCommand");
            _logger.Debug("Create.");
        }
Beispiel #4
0
        internal TaskCreateCommand()
        {
            IServiceMgr serviceMgr = ServiceMgr.Current;

            _logMgr          = serviceMgr.GetInstance <ILogMgr>();
            _logger          = _logMgr.GetLogger("TaskCreateCommand");
            _commonDbService = serviceMgr.GetInstance <ICommonService>();
            _logger.Debug("Create.");
            _logger.Debug("Interfaces: ICommonDbService = {0};", _commonDbService.ToStateString());
        }
        internal RequestListCommand(IMainController mainController)
        {
            _mainController = mainController;
            IServiceMgr serviceMgr = ServiceMgr.Current;

            _logMgr          = serviceMgr.GetInstance <ILogMgr>();
            _logger          = _logMgr.GetLogger("RequestListCommand");
            _commonDbService = serviceMgr.GetInstance <ICommonService>();
            _logger.Debug("Create.");
            _logger.Debug("Interfaces: ICommonDbService = {0}; Request.IMainController = {1}", _commonDbService.ToStateString(), _mainController.ToStateString());
        }
Beispiel #6
0
        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();
        }
Beispiel #7
0
        public MainController()
        {
            IServiceMgr serviceMgr = ServiceMgr.Current;

            _logMgr           = serviceMgr.GetInstance <ILogMgr>();
            _connection       = serviceMgr.GetInstance <IDbConnection>();
            _messageBoxMgr    = serviceMgr.GetInstance <IMessageBoxMgr>();
            _viewFormMgr      = serviceMgr.GetInstance <IViewFormMgr>();
            _commonDbAccessor = serviceMgr.GetInstance <ICommonDbAccessor>();
            _nsiController    = serviceMgr.GetInstance <INsiController>();
            _eventMgr         = serviceMgr.GetInstance <IEventMgr>();
            _logger           = _logMgr.GetLogger("MainController");
            _logger.Debug("Create.");

            _isFirstConnect = true;
            _currentUser    = UserEntity.Create();
        }
Beispiel #8
0
        public MainController(IDbAccessor dbAccessor)
        {
            _dbAccessor = dbAccessor;
            IServiceMgr serviceMgr = ServiceMgr.Current;

            _logMgr        = serviceMgr.GetInstance <ILogMgr>();
            _logger        = _logMgr.GetLogger("Request.MainController");
            _dialogMgr     = serviceMgr.GetInstance <IViewFormMgr>();
            _regionMgr     = serviceMgr.GetInstance <IRegionMgr>();
            _commonService = serviceMgr.GetInstance <ICommonService>();
            _dbMgr         = serviceMgr.GetInstance <IDbMgr>();
            _eventMgr      = serviceMgr.GetInstance <IEventMgr>();
            _logger.Debug("Create.");
            _logger.Debug("Interfaces: IDBMgr = {0}; ICommonDbService = {1}; _dialogMgr = {2}; IRegionMgr = {3}; IEventMgr = {4}.", _dbMgr.ToStateString(), _commonService.ToStateString(), _dialogMgr.ToStateString(), _regionMgr.ToStateString(), _eventMgr.ToStateString());

            Init();
        }
Beispiel #9
0
        protected override void InitInternal()
        {
            IServiceMgr serviceMgr = ServiceMgr.Current;

            _regionMgr = serviceMgr.GetInstance <IRegionMgr>();

            _plugginMenuCommand = new TaskPlugginMenuCommand();
            _bugListCommand     = new TaskListCommand();
            _bugCreateCommand   = new TaskCreateCommand();

            _plugginMenuCommandKey = _regionMgr.GetCommandRegion(RegionName.PlugginMenuItem).AddCommand(_plugginMenuCommand);

            _plugginMenuTaskListCommandKey = _regionMgr.GetCommandRegion(RegionName.PlugginMenuItem).AddCommand(_bugListCommand, _plugginMenuCommand.Name);
            _mainToolBarTaskListCommandKey = _regionMgr.GetCommandRegion(RegionName.MainToolBar).AddCommand(_bugListCommand);

            _plugginMenuTaskCreateCommandKey = _regionMgr.GetCommandRegion(RegionName.PlugginMenuItem).AddCommand(_bugCreateCommand, _plugginMenuCommand.Name);
            _mainToolBarTaskCreateCommandKey = _regionMgr.GetCommandRegion(RegionName.MainToolBar).AddCommand(_bugCreateCommand);

            _eventMgr = serviceMgr.GetInstance <IEventMgr>();

            Subscribe();
        }
Beispiel #10
0
 public Pluggin(IServiceMgr serv, IEventMgr ev) : base()
 {
 }