RemoteSystemSessionInfo Kelas

Definisi

Berisi informasi identifikasi tentang sesi jarak jauh.

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
Warisan
Object Platform::Object IInspectable RemoteSystemSessionInfo
Atribut

Persyaratan Windows

Rangkaian perangkat
Windows 10 Creators Update (diperkenalkan dalam 10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (diperkenalkan dalam v4.0)
Kemampuan aplikasi
remoteSystem

Contoh

Lihat contoh kode di bawah ini untuk proses lengkap menemukan sesi jarak jauh (termasuk mendapatkan referensi ke instans 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();
}

Setelah referensi RemoteSystemSessionInfo diperoleh, referensi tersebut dapat digunakan untuk mengeluarkan permintaan gabungan. Lihat contoh kode di bawah ini untuk proses bergabung dengan sesi jarak jauh.

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
    }
}

Keterangan

Sesi yang telah bergabung diwakili oleh objek RemoteSystemSession . Sesi yang diketahui tetapi belum bergabung diwakili oleh objek RemoteSystemSessionInfo .

Properti

ControllerDisplayName

Mendapatkan nama komputer perangkat yang merupakan pengontrol sesi jarak jauh.

DisplayName

Mendapatkan nama publik untuk sesi jarak jauh, yang diberikan oleh pengontrol sesi.

Metode

JoinAsync()

Mengeluarkan permintaan dari perangkat panggilan untuk bergabung dengan sesi jarak jauh yang diberikan.

Berlaku untuk