Exemplo n.º 1
0
        public ReportGeneratorService()
        {
            _logger = NLog.LogManager.GetCurrentClassLogger();
            _logger.Info("[ReportGeneratorService] Service started");

            if (ConfigurationManager.GetSection("reportGeneratorSection") is ReportGeneratorSection config)
            {
                _path     = config.Directory.Path;
                _interval = config.Interval.Interval;
                _logger.Info($"[ReportGeneratorService] Path = '{_path}'  interval='{_interval}' was read from config file");
                _reportGenerator = new ReportGenerator(new Writer(_path), new TradeWorker(new TradeAdapter(), new PeriodWorker()), _logger);
                _logger.Info($"[ReportGeneratorService] ReportGenerator was created with path = '{_path}'");
                _timer = new Timer(WorkProcedure);
                InitializeComponent();
            }
            else
            {
                _logger.Error("[ReportGeneratorService] Can't read config file");
                throw new ConfigurationErrorsException();
            }
        }
Exemplo n.º 2
0
        public TradingPositionAnalyzer()
        {
            var reportLocation = ConfigurationManager.AppSettings.Get("ReportsLocation");

            _reportGenerator = new ReportGenerator(reportLocation);
        }