private void ShowCore() { using (ImpersonationHelper.Impersonate(_connection)) { using (var server = _service.GetServer(_connection.Server)) { server.Open(); var session = server.GetSession(_sessionId); var result = session.MessageBox(_text, _title, _buttons, RemoteMessageBoxIcon.Warning,
public void Logoff(ConnectionDetails connection, int sessionId) { using (ImpersonationHelper.Impersonate(connection)) { using (var server = GetServer(connection.Server)) { server.Open(); server.GetSession(sessionId).Logoff(); } } }
public ConnectionState GetSessionState(ConnectionDetails connection, int sessionId) { using (ImpersonationHelper.Impersonate(connection)) { using (var server = GetServer(connection.Server)) { server.Open(); return(server.GetSession(sessionId).ConnectionState); } } }
private void ShowCore() { using (ImpersonationHelper.Impersonate(_connection)) { using (var server = _service.GetServer(_connection.Server)) { server.Open(); var session = server.GetSession(_sessionId); var result = session.MessageBox(_text, _title, _buttons, RemoteMessageBoxIcon.Warning, default(RemoteMessageBoxDefaultButton), default(RemoteMessageBoxOptions), _timeout, true); _service.SetLastMessageBoxResult(result); } } }
public bool SessionExists(ConnectionDetails connection, int sessionId) { using (ImpersonationHelper.Impersonate(connection)) { using (var server = GetServer(connection.Server)) { server.Open(); try { var session = server.GetSession(sessionId); // Windows XP sometimes connects you to session 0, and that session still exists after // logging the user off, as a disconnected console session but with no associated username. return(session.ConnectionState != ConnectionState.Disconnected || !string.IsNullOrEmpty(session.UserName)); } catch (Exception) { return(false); } } } }