如何保存闹钟时间& Windows服务闹钟中的报警文件,在visual studio 2010中以c#语言开发 [英] How can I save alarm time & alarm file in windows service alarm clock that is developed in c# language at visual studio 2010

查看:62
本文介绍了如何保存闹钟时间& Windows服务闹钟中的报警文件,在visual studio 2010中以c#语言开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用visual studio 2010中的c#语言开发一个Windows服务闹钟。我的闹钟设计用于随时,任何日期,任何年份发出警报。但是如果我在今年凌晨3:30设置了5天之后的日期报警它不起作用,因为系统无法在日期和年份以及报警文件中保存报警时间。我怎么解决?请帮帮我。

解决方案

当然你可以做到。但是,为什么不使用已经可用并专为此目的而设计的服务呢?



它被称为Window Task Scheduler,参见 http://en.wikipedia.org/wiki/Windows_Task_Scheduler [ ^ ]。



首先,您可以使用命令行实用程序安排事件AT.EXE或CSHTASKS.EXE(替换AT.EXE),请参阅:

http://en.wikipedia.org/wiki/At_%28Windows%29 [ ^ ],

http://en.wikipedia。 org / wiki / Schtasks [ ^ ],

http://technet.microsoft.com/en-us/library/bb490866.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/windows/desktop/bb736357% 28v = vs.85%29.aspx [ ^ ]。



您还可以使用Window Task Scheduler API,请参阅:

http:// msdn .microsoft.com / zh-CN / library / windows / desktop / aa383614%28v = vs.85%29.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/windows/desktop/aa383608%28v=vs.85%29.aspx [ ^ ]。



要了解如何在.NET中使用它,请参阅此CodeProject文章:一个用于.NET的新任务计划程序类库 [ ^ ]。



-SA

hi all,
I''m developing a windows service alarm clock using c# language at visual studio 2010.My alarm clock is designed for alarming any time,any date,any year.But if I set alarm with a date of after 5 days in this year at 3:30am it doesn''t work because the system can not save the alarm time within date & year & alarm file.How can I solve it?Please help me.

解决方案

Of course you can do it. But, instead of developing your own service, why not using one which is already available and designed for such purposes?

It is called Window Task Scheduler, see http://en.wikipedia.org/wiki/Windows_Task_Scheduler[^].

First, you can schedule events using command-line utilities AT.EXE or CSHTASKS.EXE (which is replacing AT.EXE), see:
http://en.wikipedia.org/wiki/At_%28Windows%29[^],
http://en.wikipedia.org/wiki/Schtasks[^],
http://technet.microsoft.com/en-us/library/bb490866.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/bb736357%28v=vs.85%29.aspx[^].

And you also can use Window Task Scheduler API, please see:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383614%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383608%28v=vs.85%29.aspx[^].

To see how can you use it with .NET, see this CodeProject article: A New Task Scheduler Class Library for .NET[^].

—SA


这篇关于如何保存闹钟时间& Windows服务闹钟中的报警文件,在visual studio 2010中以c#语言开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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