RemoteSystemSessionController RemoteSystemSessionController RemoteSystemSessionController RemoteSystemSessionController Class

Definition

Handles the creation and management of a new remote session for other devices to join.

public : sealed class RemoteSystemSessionController : IRemoteSystemSessionControllerpublic sealed class RemoteSystemSessionController : IRemoteSystemSessionControllerPublic NotInheritable Class RemoteSystemSessionController Implements IRemoteSystemSessionController// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v4)

Examples

See the following code for an example of how to create a remote session and handle join requests.


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 == RemoteSystemSessionCreateStatus.Success) {
        // creation was successful
        RemoteSystemSession currentSession = createResult.RemoteSystemSession;

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

        // Use session ...

    } else if (createResult.Status == RemoteSystemSessionCreateStatus.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
    }
}

Remarks

Every remote session has one participant that is the session's controller. Only the controller can specify options for the session, accept join requests from would-be participants, and remove participants from the session.

Constructors

RemoteSystemSessionController(String) RemoteSystemSessionController(String) RemoteSystemSessionController(String) RemoteSystemSessionController(String)

Initializes a RemoteSystemSessionController with a custom display name.

public : RemoteSystemSessionController(PlatForm::String displayName)public RemoteSystemSessionController(String displayName)Public Sub New(displayName As String)// You can use this method in JavaScript.
Parameters
displayName
PlatForm::String String String String

The public-facing name for this remote session. It should be simple and descriptive.

RemoteSystemSessionController(String, RemoteSystemSessionOptions) RemoteSystemSessionController(String, RemoteSystemSessionOptions) RemoteSystemSessionController(String, RemoteSystemSessionOptions) RemoteSystemSessionController(String, RemoteSystemSessionOptions)

Initializes a RemoteSystemSessionController with a custom display name and specified options.

public : RemoteSystemSessionController(PlatForm::String displayName, RemoteSystemSessionOptions options)public RemoteSystemSessionController(String displayName, RemoteSystemSessionOptions options)Public Sub New(displayName As String, options As RemoteSystemSessionOptions)// You can use this method in JavaScript.
Parameters
displayName
PlatForm::String String String String

The public-facing name for this remote session. It should be simple and descriptive.

Methods

CreateSessionAsync() CreateSessionAsync() CreateSessionAsync() CreateSessionAsync()

Asynchronously attempts to create a remote session.

public : IAsyncOperation<RemoteSystemSessionCreationResult> CreateSessionAsync()public IAsyncOperation<RemoteSystemSessionCreationResult> CreateSessionAsync()Public Function CreateSessionAsync() As IAsyncOperation( Of RemoteSystemSessionCreationResult )// You can use this method in JavaScript.
Returns

RemoveParticipantAsync(RemoteSystemSessionParticipant) RemoveParticipantAsync(RemoteSystemSessionParticipant) RemoveParticipantAsync(RemoteSystemSessionParticipant) RemoveParticipantAsync(RemoteSystemSessionParticipant)

Removes a participant from the remote session.

public : IAsyncOperation<PlatForm::Boolean> RemoveParticipantAsync(RemoteSystemSessionParticipant pParticipant)public IAsyncOperation<bool> RemoveParticipantAsync(RemoteSystemSessionParticipant pParticipant)Public Function RemoveParticipantAsync(pParticipant As RemoteSystemSessionParticipant) As IAsyncOperation( Of bool )// You can use this method in JavaScript.
Parameters
Returns

An asynchronous operation containing a boolean value: true if the removal operation was a success, otherwise false.

Events

JoinRequested JoinRequested JoinRequested JoinRequested

Raised whenever another device has discovered and requested access to the remote session managed by this RemoteSystemSessionController.

public : event TypedEventHandler JoinRequested<RemoteSystemSessionController,  RemoteSystemSessionJoinRequestedEventArgs>public event TypedEventHandler JoinRequested<RemoteSystemSessionController,  RemoteSystemSessionJoinRequestedEventArgs>Public Event JoinRequested<RemoteSystemSessionController,  RemoteSystemSessionJoinRequestedEventArgs>// You can use this event in JavaScript.