RemoteSystemSessionInfo Класс

Определение

Содержит идентифицирующие сведения об удаленном сеансе.

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
Наследование
Object Platform::Object IInspectable RemoteSystemSessionInfo
Атрибуты

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

Семейство устройств
Windows 10 Creators Update (появилось в 10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (появилось в v4.0)
Возможности приложения
remoteSystem

Примеры

Полный процесс обнаружения удаленного сеанса (включая получение ссылки на экземпляр 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();
}

После получения ссылки RemoteSystemSessionInfo ее можно использовать для отправки запроса на присоединение. Процесс присоединения к удаленному сеансу см. в приведенном ниже примере кода.

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

Комментарии

Присоединенный сеанс представлен объектом RemoteSystemSession . Сеанс, который известен, но не был присоединен, представлен объектом RemoteSystemSessionInfo .

Свойства

ControllerDisplayName

Возвращает имя компьютера устройства, которое является контроллером удаленного сеанса.

DisplayName

Возвращает общедоступное имя удаленного сеанса, заданное контроллером сеанса.

Методы

JoinAsync()

Отправляет запрос от вызывающего устройства на присоединение к данному удаленному сеансу.

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