RemoteSystemSession.CreateWatcher Метод

Определение

Инициализирует и возвращает объект RemoteSystemSessionWatcher для мониторинга присутствия удаленных сеансов.

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

Возвращаемое значение

Объект-наблюдатель, используемый при обнаружении удаленных сеансов.

Требования к Windows

Возможности приложения
remoteSystem

Примеры

Процесс обнаружения удаленного сеанса см. в примере кода ниже.

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

Применяется к