I am working on a kiosk application which gives the user a selection of Citrix connections.
The idea is that the user selects a connection presented by the kiosk application, and then the kiosk launcher initiates the selected connection by running a command similar to this:
C:\Program Files\Citrix\ICA Client\wfica32.exe \\server\path\to\icaFile.ica
I want the user to stay within the Citrix session - not for any security reason, just to make it a good user experience getting to the selected session and eventually logging off. So I launch a full-screen session and everything is fine until the user logs off.
When the user logs off the Citrix session, I want to also initiate a logoff on the client computer. I've tried doing this in the obvious way by using code similar to the following:
Process citrixProcess = new Process();
citrixProcess.StartInfo = new ProcessStartInfo();
citrixProcess.StartInfo.FileName = "C:\Program Files\Citrix\ICA Client\wfica32.exe";
citrixProcess.StartInfo.Arguments = "\\server\path\to\icaFile.ica";
citrixProcess.Start();
citrixProcess.WaitForExit();
//
// Followed by code to initiate logoff from the local computer
//
But instead of waiting on the Process object the code continues right along to the next section which initiates the logoff. The result is that the Citrix session is terminated almost immediately because a local computer logoff happens immediately. My best guess is that the initial launch of wfica32.exe is exiting immediately after launching a new process to actually handle the session. But if this is what is happening it is not obvious what to do about it since wfica32.exe still appears to be running once the Citrix session is launched.
I am looking for a reliable way to detect when a Citrix session launched this way has terminated.