mardi 12 mai 2015

Run the exact same process in both interactive (Windows GUI) and non-interactive (Windows Services) environment

I need a relatively big process to be run both in GUI mode in which the end user can see the progress and in a Windows Service mode (session 0) in which the process is done in the background and the user will only see the result when the job is done.

I have done this in the past in fact, except that the process was a separate .exe file. This worked fine, but I have heard that running visible applications through a Windows service is not a very wise idea. The reason my program worked with no problem was that it required no input from the user when it was supposed to run as a scheduled job.

But what I would like to do is to use the same process in both situations without having to write the code twice. Maybe only a flag to indicate whether we are in service mode or not. But is there a design pattern that provides this?

Aucun commentaire:

Enregistrer un commentaire