private static void JobDetect() { Log.WriteLog("Start detect.", "Log\\ServiceInfo.txt", true); foreach (object key in JobProviders.Keys) { ServiceJobProvider provider = (ServiceJobProvider)JobProviders[key.ToString()]; provider.StartJob(); } Log.WriteLog("End detect.", "Log\\ServiceInfo.txt", true); }
private static void JobDetect() { int RepeatTime = Convert.ToInt32(Settings.RepeatTime); while (true) { //Log.WriteLog("Start detect.", "Log\\ServiceInfo.txt", true); foreach (object key in JobProviders.Keys) { ServiceJobProvider provider = (ServiceJobProvider)JobProviders[key.ToString()]; provider.StartJob(); } //Log.WriteLog("End detect.", "Log\\ServiceInfo.txt", true); Thread.Sleep(RepeatTime * 1000); } }
private void JobDetect() { while (true) { //Log.WriteLog("Start detect.", "Log\\ServiceInfo.txt", true); foreach (object key in JobProviders.Keys) { ServiceJobProvider provider = (ServiceJobProvider)JobProviders[key.ToString()]; // if (provider.CheckRunTime()) // { provider.StartJob(); // } } //Log.WriteLog("End detect.", "Log\\ServiceInfo.txt", true); Thread.Sleep(60000); } }
private static void JobDetect() { int repeattime = Convert.ToInt32(ConfigurationManager.AppSettings["RepeatTime"]); while (true) { Log.WriteLog("Start detect.", "Log\\ServiceInfo.txt", true); foreach (object key in JobProviders.Keys) { ServiceJobProvider provider = (ServiceJobProvider)JobProviders[key.ToString()]; provider.StartJob(); } Log.WriteLog("End detect.", "Log\\ServiceInfo.txt", true); Thread.Sleep(repeattime * 10000); } }
static void Main(string[] args) { ServiceJobSection jobSection = (ServiceJobSection)ConfigurationManager.GetSection("ServiceJobSection"); ServiceJobInfoCollection JobCollection = jobSection.JobCollection; ProviderSettingsCollection jobProviders = (ProviderSettingsCollection)jobSection.JobProviders; for (int i = 0; i < JobCollection.Count; i++) { ProviderSettings providerSetting = jobProviders[JobCollection[i].Provider]; ServiceJobProvider provider = (ServiceJobProvider)ProvidersHelper.InstantiateProvider(providerSetting, typeof(ServiceJobProvider)); if (!JobProviders.Contains(JobCollection[i].JobName)) { provider.JobInfo = JobCollection[i]; JobProviders.Add(JobCollection[i].JobName, provider); } } JobDetect(); }
protected override void OnStart(string[] args) { ServiceJobSection jobSection = (ServiceJobSection)ConfigurationManager.GetSection("ServiceJobSection"); ServiceJobInfoCollection JobCollection = jobSection.JobCollection; ProviderSettingsCollection jobProviders = (ProviderSettingsCollection)jobSection.JobProviders; for (int i = 0; i < JobCollection.Count; i++) { ProviderSettings providerSetting = jobProviders[JobCollection[i].Provider]; ServiceJobProvider provider = (ServiceJobProvider)ProvidersHelper.InstantiateProvider(providerSetting, typeof(ServiceJobProvider)); if (!JobProviders.Contains(JobCollection[i].JobName)) { provider.JobInfo = JobCollection[i]; JobProviders.Add(JobCollection[i].JobName, provider); } } Thread threadJobDetect = new Thread(new ThreadStart(this.JobDetect)); threadJobDetect.Start(); Log.WriteLog(Resources.ServiceStarted, "Log\\ServiceInfo.txt", true); }