SessionChangeReason SessionChangeReason SessionChangeReason SessionChangeReason Enum

Definición

Especifica la razón para un aviso de cambio de sesión de Servicios de Terminal Server.Specifies the reason for a Terminal Services session change notice.

public enum class SessionChangeReason
public enum SessionChangeReason
type SessionChangeReason = 
Public Enum SessionChangeReason
Herencia
SessionChangeReasonSessionChangeReasonSessionChangeReasonSessionChangeReason

Campos

ConsoleConnect ConsoleConnect ConsoleConnect ConsoleConnect 1

Una sesión de consola se ha conectado.A console session has connected.

ConsoleDisconnect ConsoleDisconnect ConsoleDisconnect ConsoleDisconnect 2

Una sesión de consola se ha desconectado.A console session has disconnected.

RemoteConnect RemoteConnect RemoteConnect RemoteConnect 3

Una sesión remota se ha conectado.A remote session has connected.

RemoteDisconnect RemoteDisconnect RemoteDisconnect RemoteDisconnect 4

Una sesión remota se ha desconectado.A remote session has disconnected.

SessionLock SessionLock SessionLock SessionLock 7

Se ha bloqueado una sesión.A session has been locked.

SessionLogoff SessionLogoff SessionLogoff SessionLogoff 6

Un usuario ha cerrado una sesión.A user has logged off from a session.

SessionLogon SessionLogon SessionLogon SessionLogon 5

Un usuario ha iniciado una sesión.A user has logged on to a session.

SessionRemoteControl SessionRemoteControl SessionRemoteControl SessionRemoteControl 9

El estado del control remoto de una sesión ha cambiado.The remote control status of a session has changed.

SessionUnlock SessionUnlock SessionUnlock SessionUnlock 8

Se ha desbloqueado una sesión.A session has been unlocked.

Ejemplos

En el ejemplo de código siguiente se muestra el uso de la SessionChangeReason en una implementación de la enumeración de la OnSessionChange método en una clase derivada de ServiceBase.The following code example shows the use of the SessionChangeReason enumeration in an implementation of the OnSessionChange method in a class derived from ServiceBase. Este ejemplo de código forma parte de un ejemplo más extenso proporcionado para el ServiceBase clase.This code example is part of a larger example provided for the ServiceBase class.

        // Handle a session change notice
        protected override void OnSessionChange(SessionChangeDescription changeDescription)
        {
#if LOGEVENTS
            EventLog.WriteEntry("SimpleService.OnSessionChange", DateTime.Now.ToLongTimeString() +
                " - Session change notice received: " +
                changeDescription.Reason.ToString() + "  Session ID: " +
                changeDescription.SessionId.ToString());
#endif

            switch (changeDescription.Reason)
            {
                case SessionChangeReason.SessionLogon:
                    userCount += 1;
#if LOGEVENTS
                    EventLog.WriteEntry("SimpleService.OnSessionChange",
                        DateTime.Now.ToLongTimeString() +
                        " SessionLogon, total users: " +
                        userCount.ToString());
#endif
                    break;
                case SessionChangeReason.SessionLogoff:

                    userCount -= 1;
#if LOGEVENTS
                    EventLog.WriteEntry("SimpleService.OnSessionChange",
                        DateTime.Now.ToLongTimeString() +
                        " SessionLogoff, total users: " +
                        userCount.ToString());
#endif
                    break;
                case SessionChangeReason.RemoteConnect:
                    userCount += 1;
#if LOGEVENTS
                    EventLog.WriteEntry("SimpleService.OnSessionChange",
                        DateTime.Now.ToLongTimeString() +
                        " RemoteConnect, total users: " +
                        userCount.ToString());
#endif
                    break;
                case SessionChangeReason.RemoteDisconnect:
                    userCount -= 1;
#if LOGEVENTS
                    EventLog.WriteEntry("SimpleService.OnSessionChange",
                        DateTime.Now.ToLongTimeString() +
                        " RemoteDisconnect, total users: " +
                        userCount.ToString());
#endif
                    break;
                case SessionChangeReason.SessionLock:
#if LOGEVENTS
                    EventLog.WriteEntry("SimpleService.OnSessionChange",
                        DateTime.Now.ToLongTimeString() +
                        " SessionLock");
#endif
                    break;
                case SessionChangeReason.SessionUnlock:
#if LOGEVENTS
                    EventLog.WriteEntry("SimpleService.OnSessionChange",
                        DateTime.Now.ToLongTimeString() +
                        " SessionUnlock");
#endif
                    break;
                default:
                    break;
            }
        }
    ' Handle a session change notice
    Protected Overrides Sub OnSessionChange(ByVal changeDescription As SessionChangeDescription)
#If LOGEVENTS Then
        System.Diagnostics.EventLog.WriteEntry("SimpleService.OnSessionChange", DateTime.Now.ToLongTimeString() + " - Session change notice received: " + changeDescription.Reason.ToString() + "  Session ID: " + changeDescription.SessionId.ToString())
#End If

        Select Case changeDescription.Reason
            Case SessionChangeReason.SessionLogon
                userCount += 1
#If LOGEVENTS Then
                System.Diagnostics.EventLog.WriteEntry("SimpleService.OnSessionChange", DateTime.Now.ToLongTimeString() + " SessionLogon, total users: " + userCount.ToString())
#End If
            Case SessionChangeReason.SessionLogoff

                userCount -= 1
#If LOGEVENTS Then
                System.Diagnostics.EventLog.WriteEntry("SimpleService.OnSessionChange", DateTime.Now.ToLongTimeString() + " SessionLogoff, total users: " + userCount.ToString())
#End If
            Case SessionChangeReason.RemoteConnect
                userCount += 1
#If LOGEVENTS Then
                System.Diagnostics.EventLog.WriteEntry("SimpleService.OnSessionChange", DateTime.Now.ToLongTimeString() + " RemoteConnect, total users: " + userCount.ToString())
#End If
            Case SessionChangeReason.RemoteDisconnect
                userCount -= 1
#If LOGEVENTS Then
                System.Diagnostics.EventLog.WriteEntry("SimpleService.OnSessionChange", DateTime.Now.ToLongTimeString() + " RemoteDisconnect, total users: " + userCount.ToString())
#End If
            Case SessionChangeReason.SessionLock
#If LOGEVENTS Then
                System.Diagnostics.EventLog.WriteEntry("SimpleService.OnSessionChange", DateTime.Now.ToLongTimeString() + " SessionLock")
#End If
            Case SessionChangeReason.SessionUnlock
#If LOGEVENTS Then
                System.Diagnostics.EventLog.WriteEntry("SimpleService.OnSessionChange", DateTime.Now.ToLongTimeString() + " SessionUnlock")
#End If
            Case Else
        End Select

    End Sub 'OnSessionChange

Se aplica a