public WindowsService() { _console = new ServerConsole(); ServiceName = Constants.ServiceName; //TODO: Inject before this point var configBusiness = new ConfigBusiness(new FileLoaderAgent()); configBusiness.InvalidConfigEvent += InvalidConfigEvent; var influxDbAgentLoader = new InfluxDbAgentLoader(); var counterBusiness = new CounterBusiness(); var publisherBusiness = new PublisherBusiness(); counterBusiness.GetPerformanceCounterEvent += GetPerformanceCounterEvent; CounterBusiness.ChangedCurrentCultureEvent += ChangedCurrentCultureEvent; var sendBusiness = new SendBusiness(configBusiness, influxDbAgentLoader); sendBusiness.SendBusinessEvent += SendBusinessEvent; var tagLoader = new TagLoader(configBusiness); _processor = new Processor(configBusiness, counterBusiness, publisherBusiness, sendBusiness, tagLoader); _processor.EngineActionEvent += _processor_EngineActionEvent; _logger = new MyLogger(); // These Flags set whether or not to handle that specific // type of event. Set to true if you need it, false otherwise. CanHandlePowerEvent = true; CanHandleSessionChangeEvent = true; CanPauseAndContinue = true; CanShutdown = true; CanStop = true; _console.LineWrittenEvent += _console_LineWrittenEvent; }
public WindowsService() { _console = new ServerConsole(); ServiceName = Constants.ServiceName; //TODO: This can be removed when the new version of Tharga.Toolkit.Console is used. One version after 1.5.13.0 will do this for you. if (!EventLog.SourceExists(ServiceName)) { EventLog.CreateEventSource(ServiceName, "Application"); } //TODO: Inject before this point var configBusiness = new ConfigBusiness(new FileLoaderAgent()); configBusiness.InvalidConfigEvent += InvalidConfigEvent; var influxDbAgentLoader = new InfluxDbAgentLoader(); var counterBusiness = new CounterBusiness(); counterBusiness.GetPerformanceCounterEvent += GetPerformanceCounterEvent; var sendBusiness = new SendBusiness(configBusiness, influxDbAgentLoader); sendBusiness.SendBusinessEvent += SendBusinessEvent; var tagLoader = new TagLoader(configBusiness); _processor = new Processor(configBusiness, counterBusiness, sendBusiness, tagLoader); _processor.EngineActionEvent += _processor_EngineActionEvent; // These Flags set whether or not to handle that specific // type of event. Set to true if you need it, false otherwise. CanHandlePowerEvent = true; CanHandleSessionChangeEvent = true; CanPauseAndContinue = true; CanShutdown = true; CanStop = true; }
public CompositeRoot() { ClientConsole = new ClientConsole(); InfluxDbAgentLoader = new InfluxDbAgentLoader(); FileLoaderAgent = new FileLoaderAgent(); ConfigBusiness = new ConfigBusiness(FileLoaderAgent); ConfigBusiness.InvalidConfigEvent += InvalidConfigEvent; CounterBusiness = new CounterBusiness(); SendBusiness = new SendBusiness(ConfigBusiness, InfluxDbAgentLoader); SendBusiness.SendBusinessEvent += SendBusinessEvent; TagLoader = new TagLoader(ConfigBusiness); }