private static void ScheduleJob(IJobDetail jobDetail, WorkerOptions options)
        {
            Logger.DebugFormat("Scheduling job - {0} - to run every {1} seconds", options.Name, options.PollInterval);

            // Let's create a trigger
            ITrigger trigger = TriggerBuilder.Create()

                // A description helps other people understand what you want
                .WithDescription(String.Format("Every {0} seconds", options.PollInterval))

                // A daily time schedule gives you a
                // DailyTimeIntervalScheduleBuilder which provides
                // a fluent interface to build a schedule
                .WithSimpleSchedule(x => x
                    // Here we specify the interval
                    .WithIntervalInSeconds(options.PollInterval)
                    .RepeatForever()
                )
                .StartNow()
                .Build();

            // Ask the scheduler to schedule our EmailJob
            Scheduler.ScheduleJob(jobDetail, trigger);
        }
        private static IJobDetail CreateJob(WorkerOptions options)
        {
            // The job builder uses a fluent interface to
            // make it easier to build and generate an
            // IJobDetail object
            var pollingJobDetail = JobBuilder.Create<PollWebsiteJob>()
                .WithIdentity(options.Name)   // Here we can assign a friendly name to our job
                .Build();                       // And now we build the job detail

            // Put options into data map
            pollingJobDetail.JobDataMap.Put("JobName", options.Name);
            pollingJobDetail.JobDataMap.Put("Url", options.Url);
            pollingJobDetail.JobDataMap.Put("HttpMethod", options.HttpMethod);
            if (!String.IsNullOrEmpty(options.PostValues))
            {
                pollingJobDetail.JobDataMap.Put("PostValues", options.PostValues);
            }

            return pollingJobDetail;
        }
        private static void ReadOptionsFromConfig()
        {
            // Make sure we have options to change
            if (_options == null)
                _options = new WorkerOptions();

            string configUrl = ConfigurationManager.AppSettings["Url"];
            if (!String.IsNullOrEmpty(configUrl))
            {
                _options.Url = configUrl;
            }

            string pollInterval = ConfigurationManager.AppSettings["PollIntervalInSeconds"];
            if (!String.IsNullOrEmpty(pollInterval))
            {
                _options.PollInterval = int.Parse(pollInterval);
            }
        }