如何编写C#调度 [英] How to write C# Scheduler

查看:140
本文介绍了如何编写C#调度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样写一个警告,这将在00:00运行,零点15分,00:30等每天?

How do I write a Alert which will run at 00:00, 00:15, 00:30, and so on every day?

你能不能给我一个例子代码?

Can you give me an example code?

感谢您。

推荐答案

您可以使用运行,检查当前的时间每一分钟的计时器。该检查可以是这样的:

You can use a timer that runs every minute that checks the current time. The check can look like:

private void OnTimerTick()
{
    if(DateTime.Now.Minutes%15==0)
    {
        //Do something
    }
}

但是,如果你正在寻找一个程序或服务,具有每15分钟就可以只写你的应用程序并开始使用计划任务窗口中运行。

But if you are looking for a program or service that has to be run every 15 minutes you can just write your application and have it started using a windows planned task.

这篇关于如何编写C#调度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆