check caller before ServiceBase.Run?

  • Thread starter Thread starter stevenkobes
  • Start date Start date
S

stevenkobes

I have a service application in C#. If the user double-clicks the
service EXE, I want to display a form with options to install or
uninstall. In other words, I want:

static void Main()
{
if (invoked by user) { // <-- how to implement this?
// display GUI...
}
else { // invoked by SCM
ServiceBase.Run(new ServiceBase[] { new MyServiceClass() });
}
}

How can I determine how the EXE was invoked?

Thanks!
Steve
 
How can I determine how the EXE was invoked?

Try checking System.Environment.UserInteractive.


Mattias
 
Back
Top