public void Start() { var config = BackupConfigurationSection.GetSection(); BackupWorker.Start(config); host = new ServiceHost(typeof(BackupService)); host.Open(); if (config.Cleaner.ElementInformation.IsPresent) { cleanerService = new BackupCleanerService { Period = config.Cleaner.Period }; cleanerService.Start(); } if (config.Scheduler.ElementInformation.IsPresent) { schedulerService = new BackupSchedulerService { Period = config.Scheduler.Period }; schedulerService.Start(); } deleterTempService = new BackupCleanerTempFileService(); deleterTempService.Start(); }
public void Stop() { BackupWorker.Stop(); if (host != null) { host.Close(); host = null; } if (cleanerService != null) { cleanerService.Stop(); cleanerService = null; } if (schedulerService != null) { schedulerService.Stop(); schedulerService = null; } if (deleterTempService != null) { deleterTempService.Stop(); deleterTempService = null; } }