Пример #1
0
 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,
Пример #2
0
 public void Logoff(ConnectionDetails connection, int sessionId)
 {
     using (ImpersonationHelper.Impersonate(connection))
     {
         using (var server = GetServer(connection.Server))
         {
             server.Open();
             server.GetSession(sessionId).Logoff();
         }
     }
 }
Пример #3
0
 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);
         }
     }
 }
Пример #5
0
 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);
             }
         }
     }
 }