public CentralService(PDFGenerator pdfGenerator, AppDataFileWatcher appDataFileWatcher)
        {
            _pdfGenerator  = pdfGenerator;
            _fileProcessor = new FileProcessor(_pdfGenerator);
            appDataFileWatcher.Start();

            var timer = new Timer();

            timer.Elapsed += OnTimedSaveDocumentEvent;
            timer.Elapsed += OnTimedEvent;
            timer.Interval = 1000;
            timer.Enabled  = true;
        }
예제 #2
0
        public static void Configure()
        {
            var pdfGenerator       = new PDFGenerator(Configuration.PDFFileName);
            var appDataFileWatcher = new AppDataFileWatcher(AppDomain.CurrentDomain.BaseDirectory);

            HostFactory.Run(configure =>
            {
                configure.Service <CentralService>(service =>
                {
                    service.ConstructUsing(s => new CentralService(pdfGenerator, appDataFileWatcher));
                    service.WhenStarted(s => s.Start());
                    service.WhenStopped(s => s.Stop());
                });

                configure.RunAsLocalSystem();
                configure.SetServiceName(Configuration.ServiceName);
                configure.SetDisplayName(Configuration.DisplayName);
                configure.SetDescription(Configuration.Description);
            });
        }
예제 #3
0
 public FileProcessor(PDFGenerator pdfGenerator)
 {
     _pdfGenerator = pdfGenerator;
 }