RemoteSystemSession 클래스

정의

연결된 두 개 이상의 디바이스 간에 공유할 수 있는 원격 세션을 나타내고 처리합니다. 이 기능에 대한 자세한 내용은 설명을 참조하세요.

public ref class RemoteSystemSession sealed : IClosable
/// [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 RemoteSystemSession final : IClosable
[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 RemoteSystemSession : System.IDisposable
Public NotInheritable Class RemoteSystemSession
Implements IDisposable
상속
Object Platform::Object IInspectable RemoteSystemSession
특성
구현

Windows 요구 사항

디바이스 패밀리
Windows 10 Creators Update (10.0.15063.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v4.0에서 도입되었습니다.)
앱 기능
remoteSystem

예제

원격 세션에 조인하는 프로세스(RemoteSystemSession instance 대한 참조 가져오기 포함)는 아래 코드 예제를 참조하세요.

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

또는 원격 세션을 만들고 조인 요청을 처리하는 방법에 대한 예제는 다음 코드를 참조하세요.

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

설명

원격 시스템 세션은 광범위한 원격 시스템 기능 집합의 일부입니다. 이를 통해 앱은 두 개 이상의 디바이스가 지속적으로 통신할 수 있는 중간 타사로 세션 개체를 설정할 수 있으므로 원격 앱 메시징과 같은 여러 가지 새로운 디바이스 간 시나리오를 사용할 수 있습니다.

조인된 세션은 RemoteSystemSession 개체로 표시됩니다. 에 대해 알려져 있지만 조인되지 않은 세션은 RemoteSystemSessionInfo 개체로 표시됩니다.

속성

ControllerDisplayName

이 원격 세션의 컨트롤러인 디바이스의 컴퓨터 이름을 가져옵니다.

DisplayName

세션의 컨트롤러가 지정한 이 원격 세션의 공용 이름을 가져옵니다.

Id

이 원격 세션에 대한 고유 식별자를 가져옵니다.

메서드

Close()

세션을 닫고 모든 참가자의 연결을 끊습니다.

CreateParticipantWatcher()

RemoteSystemSessionParticipantWatcher를 초기화하여 이 원격 세션의 참가자를 모니터링합니다.

CreateWatcher()

RemoteSystemSessionWatcher 개체를 초기화하고 반환하여 원격 세션의 존재를 모니터링합니다.

Dispose()

관리되지 않는 리소스의 확보, 해제 또는 다시 설정과 관련된 애플리케이션 정의 작업을 수행합니다.

SendInvitationAsync(RemoteSystem)

지정된 원격 디바이스를 이 원격 세션에 참가하도록 초대합니다.

이벤트

Disconnected

이 디바이스가 이 원격 세션에서 연결이 끊어졌을 때 발생합니다.

적용 대상