示例#1
0
 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);
 }
示例#2
0
        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);
            }
        }
示例#3
0
 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);
     }
 }
示例#4
0
        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);
            }
        }
示例#5
0
        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();
        }
示例#6
0
        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);
        }