RemoteSystemSessionInfo Classe

Definizione

Contiene informazioni di identificazione su una sessione remota.

public ref class RemoteSystemSessionInfo sealed
/// [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 RemoteSystemSessionInfo final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 262144)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class RemoteSystemSessionInfo final
[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 RemoteSystemSessionInfo
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 262144)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class RemoteSystemSessionInfo
Public NotInheritable Class RemoteSystemSessionInfo
Ereditarietà
Object Platform::Object IInspectable RemoteSystemSessionInfo
Attributi

Requisiti Windows

Famiglia di dispositivi
Windows 10 Creators Update (è stato introdotto in 10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (è stato introdotto in v4.0)
Funzionalità dell'app
remoteSystem

Esempio

Per il processo completo di individuazione di una sessione remota, vedere l'esempio di codice seguente, incluso il recupero di un riferimento a un'istanza di RemoteSystemSessionInfo .

// Discover an existing shared experience.
public void DiscoverExistingSessions() {

    // create a watcher for remote system sessions
    RemoteSystemSessionWatcher sessionWatcher = RemoteSystemSession.CreateWatcher();

    // register a handler for the "added" event
    sessionWatcher.Added += async (sender, args) => {

        // get a reference to the info about the discovered session
        RemoteSystemSessionInfo sessionInfo = args.RemoteSystemSessionInfo;

        // update the UI with the sessionInfo.DisplayName and 
        // sessionInfo.ControllerDisplayName strings. Save a reference to 
        // this RemoteSystemSessionInfo, to use when the user selects
        // this session from the UI

        //...
    };

    // Begin watching
    sessionWatcher.Start();
}

Dopo aver acquisito un riferimento RemoteSystemSessionInfo , può essere usato per inviare una richiesta di join. Per il processo di aggiunta a una sessione remota, vedere l'esempio di codice seguente.

public async void JoinExistingSession() {

    // request to join. sessionInfo has already been selected by user.
    RemoteSystemSessionJoinResult joinResult = await sessionInfo.JoinAsync();

    // process the result
    if (joinResult.Status == RemoteSystemSessionJoinStatus.Success) {

        // if the join was successful, acquire a reference to the session
        currentSession = joinResult.Session;

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

        // update the UI with the session.DisplayName and 
        // session.ControllerDisplayName strings. Save a reference to 
        // this RemoteSystemSession, to use when the user selects
        // this session from the UI

    } else {
        // join request failed. optionally update UI
    }
}

Commenti

Una sessione aggiunta è rappresentata da un oggetto RemoteSystemSession . Una sessione nota su ma non è stata aggiunta è rappresentata da un oggetto RemoteSystemSessionInfo .

Proprietà

ControllerDisplayName

Ottiene il nome del computer del dispositivo che è il controller della sessione remota.

DisplayName

Ottiene il nome pubblico per la sessione remota, specificato dal controller della sessione.

Metodi

JoinAsync()

Invia una richiesta dal dispositivo chiamante per partecipare alla sessione remota specificata.

Si applica a