/// <summary> /// The main entry point for the application. /// </summary> static void Main() { ServiceBase[] ServicesToRun; var appSettingConfigurationService = new AppSettingConfigurationService(); IReportingService reportingService = new SqlServerReportingService(new MachineIdentificationService(appSettingConfigurationService), new DateTimeService(), new WatchServerRepository(appSettingConfigurationService)); ServicesToRun = new ServiceBase[] { new CPUCollectorService(new CPUHeartbeatService(appSettingConfigurationService, reportingService)) }; ServiceBase.Run(ServicesToRun); var transmitTimer = new Timer(state => { reportingService.ExtractReports(); }, null, TimeSpan.FromSeconds(2).Milliseconds, TimeSpan.FromSeconds(2).Milliseconds); }
static void Main(string[] args) { var appSettingConfigurationService = new AppSettingConfigurationService(); IReportingService reportingService = new ConsoleReportingService(new DateTimeService(), appSettingConfigurationService); IHeartbeatService cpuHeartbeatService = new CPUHeartbeatService(appSettingConfigurationService, reportingService); IHeartbeatService driveTotalUsedHeartbeatService = new DiskDriveTotalUsedHeartbeatService(appSettingConfigurationService, reportingService); IHeartbeatService driveSizeHeartbeatService = new DiskDriveSizeHeartbeatService(appSettingConfigurationService, reportingService); cpuHeartbeatService.StartCollecting(); driveTotalUsedHeartbeatService.StartCollecting(); driveSizeHeartbeatService.StartCollecting(); Console.ReadLine(); }