/// <summary> /// Can only be started once, and should be started by /// the Application class. /// </summary> /// <returns>A new launcher</returns> public static iNodeService Create(iAppTheme pTheme) { if (_created) { throw new ApplicationException("Node already started."); } _created = true; return new NodeService(pTheme); }
/// <summary> /// Creates the dependency container. /// </summary> public static void Bootstrap(iAppTheme pTheme, IContainer pContainer) { Jobs.Dependencies.Bootstrap(pContainer, 100); pContainer.Configure(pExp=> { pExp.ForSingletonOf<iActionService>().Use<ActionService>(); pExp.ForSingletonOf<iAppTheme>().Use(pTheme); pExp.ForSingletonOf<iJobsView>().Use<JobsView>(); pExp.Forward<iJobsView, iActiveJobService>(); pExp.ForSingletonOf<iMainFrmService>().Use<Main>(); pExp.ForSingletonOf<iNodeService>().Use<NodeService>(); }); }
/// <summary> /// Constructor /// </summary> public Main([NotNull] iActionService pActionService, [NotNull] iAppTheme pAppTheme, [NotNull] iEngineService pEngineService, [NotNull] iJobService pJobService, [NotNull] iPluginStorage pStorage, [NotNull] iActiveJobService pActiveJobService, [NotNull] iJobsView pJobsView) { if (pActionService == null) { throw new ArgumentNullException("pActionService"); } if (pAppTheme == null) { throw new ArgumentNullException("pAppTheme"); } if (pEngineService == null) { throw new ArgumentNullException("pEngineService"); } if (pJobService == null) { throw new ArgumentNullException("pJobService"); } if (pStorage == null) { throw new ArgumentNullException("pStorage"); } if (pActiveJobService == null) { throw new ArgumentNullException("pActiveJobService"); } if (pJobsView == null) { throw new ArgumentNullException("pJobsView"); } InitializeComponent(); _theme = pAppTheme; _engineService = pEngineService; _jobService = pJobService; _storage = pStorage; _activeJobService = pActiveJobService; _actionService = pActionService; pJobsView.setJobMenu(menuJob); pJobsView.setTaskMenu(menuTask); Control reportCtrl = pJobsView.getControl(); reportCtrl.Dock = DockStyle.Fill; splitter.Panel1.Controls.Add(reportCtrl); _jobsViewStack = new JobsViewStack(pActiveJobService, _jobService) { Dock = DockStyle.Fill, TabIndex = 2 }; splitter.Panel2.Controls.Add(_jobsViewStack); pActiveJobService.JobChanged += onSelectedJobChanged; trayIcon.Text = _theme.Title; trayIcon.Icon = _theme.Icon; Text = _theme.Title; Icon = _theme.Icon; }
/// <summary> /// Constructor /// </summary> public NodeService(iAppTheme pTheme) { if (pTheme == null) { throw new ArgumentNullException("pTheme"); } _theme = pTheme; iActionService actionService = ObjectFactory.GetInstance<iActionService>(); iMainFrmService mainFrmService = ObjectFactory.GetInstance<iMainFrmService>(); actionService.Register(new Exit()); actionService.Register(new Shutdown()); actionService.Register(new ShowMain()); actionService.Register(new HideMain()); actionService.Register(new EditOptions()); actionService.Register(new ClearErrors()); actionService.Register(new Stop()); actionService.Register(new Resume()); actionService.Register(new Suspend()); ConfigureLogger(ObjectFactory.GetInstance<iJobService>()); mainFrmService.Init(); }