开发者

Add and Edit scheduled tasks via C# winform application

I wrote a windows service that resides on a windows 2008 server. I also developed a separate C# winforms application that I'd like to use to configure a task for the service to schedule its run.

The winforms app is a form UI with basic scheduling 开发者_开发技巧inputs such as day of week, time of day, etc. I'd lke the user to choose inputs and save this as a task that will schedule the running of my win service.

Is there a way to add/edit a windows scheduled task via C# winform without using 3rd party add-ons?


Alternatively, you could write the service to always be running, and have it reference a database table on when it should run. The service would simply check when it is allowed to run.

Your WinForm application could simply update the database table. Quite simple really. Of course you could make it infinitely more complex, but, for what you are describing seems relatively simple.


I don't think there's a way using purely managed code, but if you add a reference to the TASK Scheduler COM Library, you should be able to do it. (References... Add Reference... Com Objects)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜