winform如何实现每天按时执行一个方法呢.docxVIP

  • 177
  • 0
  • 约2千字
  • 约 7页
  • 2021-04-12 发布于天津
  • 举报

winform如何实现每天按时执行一个方法呢.docx

/Create Creates a new scheduled task. /Create Creates a new scheduled task. winform 如何实现每天按时执行一个方法呢 winform 如何实现每天按时执行一个方法呢 www.MyException.Cn ,网友分享于: 2014-05-29 浏览: 9 winform 怎么实现每天按时执行一个方法呢? 我想每天 8 点执行 MessageBox.show(8 点钟 ); timer 每 1 秒判断一次时间会不会占用很大的资源呢?我听 分感谢!! 别人说用计划任务做。有没有例子呢。 。求大神解答 别人说用计划任务做。 有没有例子呢。 。求大神解答 解决思路 SCHTASKS /parameter [arguments]Description: Enables an administrator to create, delete, query, change, run and end scheduled tasks on a local or remote system.Parameter List: /DeleteDeletes the scheduled task(s)./QueryDisplays all scheduled tasks./ChangeChangesthe properties of scheduled task./RunRunsthe scheduled task on demand./EndStops thecurrently running scheduled task./ShowSidShowsthe security identifier corresponding to a scheduled task name. /? /Delete Deletes the scheduled task(s). /Query Displays all scheduled tasks. /Change Changes the properties of scheduled task. /Run Runs the scheduled task on demand. /End Stops the currently running scheduled task. /ShowSid Shows the security identifier corresponding to a scheduled t ask name. /? Displays this help message.Examples: SCHTASKS SCHTASKS /? SCHTASKS /Run /? SCHTASKS /End /? SCHTASKS /Create /? SCHTASKS /Delete /? SCHTASKS /Query /? SCHTASKS /Change /? SCHTASKS /ShowSid /? 解决思路 /menglin2010/archive/2012/03/05/2380 419.html 解决思路 QuartzISchedulerFactory sf = new StdSchedulerFactory(); JobDetail job = new JobDetail(job, jobGroup, typeof(TimeJob)); //指定相同的 JobName 和 GroupName 可以使两个计时同时 进行 CronTrigger ct = new CronTrigger(cTrigger, ct_Group, job, jobGroup); //指定定时器表达式 { { { { string cronExpression = 0 00 08 * * ? *;// 每天 8 点执行 ct.CronExpressionString = cronExpression; IScheduler sched = sf.GetScheduler(); // 添加新的计时任务 sched.AddJob(job, true); sched.ScheduleJob(ct); sched.Start(); public class TimeJob:Quartz.IJob public void Execute(Quartz.JobExecutionContext context) } } } } //需要执行的任务。

文档评论(0)

1亿VIP精品文档

相关文档