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()

呼び出し元デバイスから、指定されたリモート セッションに参加するための要求を発行します。

適用対象