How can I run some common code from both (a) scheduled via Windows Task & (b) manually from within W
- by Greg
Hi,
QUESTION - How can I run some common code from both (a) scheduled via Windows Task & (b) manually from within WinForms app?
BACKGROUND:
This follows on from the http://stackoverflow.com/questions/2489999/how-can-i-schedule-tasks-in-a-winforms-app thread
REQUIREMENTS
C# .NETv3.5 project using VS2008
There is an existing function which I want to run both (a) manually from within the WinForms application, and (b) scheduled via Windows Task.
APPROACHES
So what I'm trying to understand is what options are there to make this work eg
Is it possible for a windows task to trigger a function to run within a running/existing WinForms application? (doesn't sound solid I guess)
Split code out into two projects and duplicate for both console application that the task manager would run AND code that the winforms app would run
Create a common library and re-use this for both the above-mentioned projects in the bullet above
Create a service with an interface that both the task manager can access plus the winforms app can manage
Actually each of these approaches sounds quite messy/complex - would be really nice to drop back to have the code only once within the one project in VS2008, the only reason I ask about this is I need to have a scheduling function and the suggestion has been to use http://taskscheduler.codeplex.com/ as the means to do this, which takes the scheduling out of my VS2008 project...
thanks