Ejemplo n.º 1
0
        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, new ConsoleQueueEvents(_console));
            var tagLoader    = new TagLoader(configBusiness);

            _processor = new Processor(configBusiness, counterBusiness, publisherBusiness, 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;

            _console.LineWrittenEvent += _console_LineWrittenEvent;
        }
Ejemplo n.º 2
0
        public void Setup()
        {
            var data2 = new List <Publisher> //Publisher
            {
                new Publisher {
                    Id = 1, Name = "AAA", CountryOfOrigin = "USA"
                },
                new Publisher {
                    Id = 2, Name = "BBB"
                },
                new Publisher {
                    Id = 3, Name = "CCC", CountryOfOrigin = "USA"
                },
            }.AsQueryable();

            mockDBSetPublishers = new Mock <DbSet <Publisher> >();

            mockDBSetPublishers.As <IQueryable <Publisher> >().Setup(m => m.Provider).Returns(data2.Provider);
            mockDBSetPublishers.As <IQueryable <Publisher> >().Setup(m => m.Expression).Returns(data2.Expression);
            mockDBSetPublishers.As <IQueryable <Publisher> >().Setup(m => m.ElementType).Returns(data2.ElementType);
            mockDBSetPublishers.As <IQueryable <Publisher> >().Setup(m => m.GetEnumerator()).Returns(data2.GetEnumerator());

            mockContext = new Mock <LibraryContext>();
            mockContext.Setup(c => c.Publishers).Returns(mockDBSetPublishers.Object);


            publisherBusiness = new PublisherBusiness(mockContext.Object);
        }
Ejemplo n.º 3
0
 public CompositeRoot()
 {
     ClientConsole       = new ClientConsole();
     InfluxDbAgentLoader = new InfluxDbAgentLoader();
     FileLoaderAgent     = new FileLoaderAgent();
     ConfigBusiness      = new ConfigBusiness(FileLoaderAgent);
     ConfigBusiness.InvalidConfigEvent += InvalidConfigEvent;
     CounterBusiness   = new CounterBusiness();
     PublisherBusiness = new PublisherBusiness();
     SendBusiness      = new SendBusiness(ConfigBusiness, InfluxDbAgentLoader);
     SendBusiness.SendBusinessEvent += SendBusinessEvent;
     TagLoader = new TagLoader(ConfigBusiness);
 }
Ejemplo n.º 4
0
 public CompositeRoot()
 {
     ClientConsole       = new ClientConsole();
     InfluxDbAgentLoader = new InfluxDbAgentLoader();
     FileLoaderAgent     = new FileLoaderAgent();
     ConfigBusiness      = new ConfigBusiness(FileLoaderAgent);
     ConfigBusiness.InvalidConfigEvent += InvalidConfigEvent;
     CounterBusiness   = new CounterBusiness();
     PublisherBusiness = new PublisherBusiness();
     MetaDataBusiness  = new MetaDataBusiness();
     SendBusiness      = new SendBusiness(ConfigBusiness, new ConsoleQueueEvents(ClientConsole));
     TagLoader         = new TagLoader(ConfigBusiness);
     SocketClient      = new SocketClient();
 }
Ejemplo n.º 5
0
        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();
            var publisherBusiness   = new PublisherBusiness();

            counterBusiness.GetPerformanceCounterEvent += GetPerformanceCounterEvent;
            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;

            // 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;
        }
Ejemplo n.º 6
0
 public PublisherDisplay()
 {
     publisherBusiness = new PublisherBusiness();
     Input();
 }