RemoteSystemSessionController クラス

定義

他のデバイスが参加するための新しいリモート セッションの作成と管理を処理します。

public ref class RemoteSystemSessionController sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.System.RemoteSystems.IRemoteSystemSessionControllerFactory, 262144, "Windows.Foundation.UniversalApiContract")]
/// [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 RemoteSystemSessionController final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.System.RemoteSystems.IRemoteSystemSessionControllerFactory), 262144, "Windows.Foundation.UniversalApiContract")]
[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 RemoteSystemSessionController
function RemoteSystemSessionController(displayName, options)
Public NotInheritable Class RemoteSystemSessionController
継承
Object Platform::Object IInspectable RemoteSystemSessionController
属性

Windows の要件

デバイス ファミリ
Windows 10 Creators Update (10.0.15063.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v4.0 で導入)
アプリの機能
remoteSystem

リモート セッションを作成し、参加要求を処理する方法の例については、次のコードを参照してください。

public async void StartNewSharedExperience() {

    var manager = new RemoteSystemSessionController("Bob’s Minecraft game");

    // register the following code to handle the JoinRequested event
    manager.JoinRequested += async (sender, args) => {
        // Get the deferral
        var deferral = args.GetDeferral();

        // display the participant (args.JoinRequest.Participant) on UI, giving the 
        // user an opportunity to respond
        // ...

        // If the user chooses "accept", accept this remote system as a participant
        args.JoinRequest.Accept();
    };

    // create and start the session
    RemoteSystemSessionCreationResult createResult = await manager.CreateSessionAsync();

    // handle the creation result
    if (createResult.Status == RemoteSystemSessionCreationStatus.Success) {
        // creation was successful
        RemoteSystemSession currentSession = createResult.Session;

        // optionally subscribe to the disconnection event
        currentSession.Disconnected += async (sender, args) => {
            // update the UI, using args.Reason
            // ...
        };

        // Use session ...

    } else if (createResult.Status == RemoteSystemSessionCreationStatus.SessionLimitsExceeded) {
        // creation failed. Optionally update UI to indicate that there are too many sessions in progress
    } else {
        // creation failed for an unknown reason. Optionally update UI
    }
}

注釈

すべてのリモート セッションには、セッションのコントローラーである 1 つの参加要素があります。 コントローラーのみがセッションのオプションを指定し、参加要求を受け入れ、セッションから参加者を削除できます。

重要

このクラスをインスタンス化する前に、 RemoteSystem.RequestAccessAsync の呼び出しでリモート システム プラットフォームへのアクセスを確認する必要があります。

コンストラクター

RemoteSystemSessionController(String)

カスタム表示名を使用して RemoteSystemSessionController を初期化します。

RemoteSystemSessionController(String, RemoteSystemSessionOptions)

カスタム表示名と指定したオプションを使用して RemoteSystemSessionController を初期化します。

メソッド

CreateSessionAsync()

リモート セッションの作成を非同期的に試みます。

RemoveParticipantAsync(RemoteSystemSessionParticipant)

リモート セッションから参加者を削除します。

イベント

JoinRequested

別のデバイスがこの RemoteSystemSessionController によって管理されているリモート セッションへのアクセスを検出して要求するたびに発生します。

適用対象