Not an Answer, not related to the Question.
Writing (see the Question)
if (System.Windows.Forms.SystemInformation.TerminalServerSession == true)
{
isRemoteSession = true;
}
else
{
isRemoteSession = false;
}
instead of
isRemoteSession = System.Windows.Forms.SystemInformation.TerminalServerSession;
leaves me without much hope.
Besides,
System.Windows.Forms.SystemInformation.TerminalServerSession
property indicate that the application (calling process) is run on a server computer as a part of remote session. It is always either
true
of
false
, cannot detect connection or disconnection. And certainly it will be
false
for your Windows Service. This check cannot help you at all.
Sorry,
Lydiae. Just think about it.
—SA