RemoteSystemSessionController Classe

Definição

Manipula a criação e o gerenciamento de uma nova sessão remota para outros dispositivos ingressarem.

public ref class RemoteSystemSessionController sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.System.RemoteSystems.IRemoteSystemSessionControllerFactory, 262144, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 262144)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class RemoteSystemSessionController final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.System.RemoteSystems.IRemoteSystemSessionControllerFactory), 262144, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 262144)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class RemoteSystemSessionController
function RemoteSystemSessionController(displayName, options)
Public NotInheritable Class RemoteSystemSessionController
Herança
Object Platform::Object IInspectable RemoteSystemSessionController
Atributos

Requisitos do Windows

Família de dispositivos
Windows 10 Creators Update (introduzida na 10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduzida na v4.0)
Funcionalidades do aplicativo
remoteSystem

Exemplos

Consulte o código a seguir para obter um exemplo de como criar uma sessão remota e manipular solicitações de junção.

public async void StartNewSharedExperience() {

    var manager = new RemoteSystemSessionController("Bob’s Minecraft game");

    // register the following code to handle the JoinRequested event
    manager.JoinRequested += async (sender, args) => {
        // Get the deferral
        var deferral = args.GetDeferral();

        // display the participant (args.JoinRequest.Participant) on UI, giving the 
        // user an opportunity to respond
        // ...

        // If the user chooses "accept", accept this remote system as a participant
        args.JoinRequest.Accept();
    };

    // create and start the session
    RemoteSystemSessionCreationResult createResult = await manager.CreateSessionAsync();

    // handle the creation result
    if (createResult.Status == RemoteSystemSessionCreationStatus.Success) {
        // creation was successful
        RemoteSystemSession currentSession = createResult.Session;

        // optionally subscribe to the disconnection event
        currentSession.Disconnected += async (sender, args) => {
            // update the UI, using args.Reason
            // ...
        };

        // Use session ...

    } else if (createResult.Status == RemoteSystemSessionCreationStatus.SessionLimitsExceeded) {
        // creation failed. Optionally update UI to indicate that there are too many sessions in progress
    } else {
        // creation failed for an unknown reason. Optionally update UI
    }
}

Comentários

Cada sessão remota tem um participante que é o controlador da sessão. Somente o controlador pode especificar opções para a sessão, aceitar solicitações de junção de supostos participantes e remover participantes da sessão.

Importante

Você deve confirmar o acesso à plataforma do sistema remoto com uma chamada para RemoteSystem.RequestAccessAsync antes de instanciar essa classe.

Construtores

RemoteSystemSessionController(String)

Inicializa um RemoteSystemSessionController com um nome de exibição personalizado.

RemoteSystemSessionController(String, RemoteSystemSessionOptions)

Inicializa um RemoteSystemSessionController com um nome de exibição personalizado e opções especificadas.

Métodos

CreateSessionAsync()

Tenta de forma assíncrona criar uma sessão remota.

RemoveParticipantAsync(RemoteSystemSessionParticipant)

Remove um participante da sessão remota.

Eventos

JoinRequested

Gerado sempre que outro dispositivo tiver descoberto e solicitado acesso à sessão remota gerenciada por esse RemoteSystemSessionController.

Aplica-se a