check caller before ServiceBase.Run?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • stevenkobes@hotmail.com

    check caller before ServiceBase.Run?

    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

  • Mattias Sjögren

    #2
    Re: check caller before ServiceBase.Run ?

    >How can I determine how the EXE was invoked?

    Try checking System.Environm ent.UserInterac tive.


    Mattias

    --
    Mattias Sjögren [C# MVP] mattias @ mvps.org
    http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
    Please reply only to the newsgroup.

    Comment

    Working...