Best method to cleanly shut down an application launched via another.

Posted by JYelton on Stack Overflow See other posts from Stack Overflow or by JYelton
Published on 2010-05-13T21:55:12Z Indexed on 2010/05/15 20:44 UTC
Read the original article Hit count: 258

Filed under:
|

I couldn't find any close answers to this, so I'm consulting the experience of SO users:

Scenario:

I have two small C# winforms applications where one behaves as a server or host, the other as a client. They share data via SQL Server, in terms of configuration settings.

I am currently launching the client application (which only needs to run periodically) from the server application via Process.Start() and terminating it via Process.CloseMainWindow() (after finding it in the process list).

While it seems clean enough, I wondered if there's a better way.

Question:

Which way would be best to instruct the client application to shut down:

  • Continue using Process.CloseMainWindow()?
  • Implement WCF between the applications? (I would need help on how to do this.)
  • Set a variable in SQL that the client application checks for?
  • Some other way?

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms