I created a windows form applica开发者_如何学运维tion with a button on it. When ever a user clicks that button, some process happens.
I want to schedule this app such a way that it runs some 4 times every day in a task scheduler. What i thought is every time i launch the form, i will activate the button_clicked
event code. But what this would do is it will not allow the user to click manually.
So i would like to differentiate how the form was oppened by a user or by a scheduler? Is there a way to distinguish ? I know there might be some very easy way to handle this requirement like making my app like a service or some batchfile etc.
I am just curious to know if this kind of differentiation can be made?
The easiest way to do this is to simply pass a parameter to your application when you run it in the scheduler and check for that parameter inside your application.
精彩评论