Bagikan melalui


RemoteSystemSession.CreateWatcher Metode

Definisi

Menginisialisasi dan mengembalikan objek RemoteSystemSessionWatcher untuk memantau keberadaan sesi jarak jauh.

public:
 static RemoteSystemSessionWatcher ^ CreateWatcher();
 static RemoteSystemSessionWatcher CreateWatcher();
public static RemoteSystemSessionWatcher CreateWatcher();
function createWatcher()
Public Shared Function CreateWatcher () As RemoteSystemSessionWatcher

Mengembalikan

Objek pengamat yang akan digunakan dalam menemukan sesi jarak jauh.

Persyaratan Windows

Kemampuan aplikasi
remoteSystem

Contoh

Lihat contoh kode di bawah ini untuk proses menemukan sesi jarak jauh.

// 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();
}

Berlaku untuk