RemoteSystemSessionInvitationListener 类

定义

包含用于接收和处理加入远程会话的邀请的功能。 此类在实例化邀请后开始侦听邀请。

public ref class RemoteSystemSessionInvitationListener sealed
/// [Windows.Foundation.Metadata.Activatable(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 RemoteSystemSessionInvitationListener final
[Windows.Foundation.Metadata.Activatable(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 RemoteSystemSessionInvitationListener
function RemoteSystemSessionInvitationListener()
Public NotInheritable Class RemoteSystemSessionInvitationListener
继承
Object Platform::Object IInspectable RemoteSystemSessionInvitationListener
属性

Windows 要求

设备系列
Windows 10 Creators Update (在 10.0.15063.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v4.0 中引入)
应用功能
remoteSystem

示例

有关如何接收和处理远程会话邀请的示例,请参阅以下代码。

public void SubscribeAndHandleInvites() {
    var invitationListener = new RemoteSystemSessionInvitationListener();

    // register the following code to handle this event:
    invitationListener.InvitationReceived += async (sender, args) => {

        // issue a join request to the session
        RemoteSystemSessionJoinResult joinResult = await args.Invitation.RemoteSystemSessionInfo.JoinAsync();

        // handle the join result as in the normal session discovery scenario
        // ...
    };
}

注解

重要

必须先通过调用 RemoteSystem.RequestAccessAsync 来确认对远程系统平台的访问,然后才能为此类的事件设置处理程序 () () 。

构造函数

RemoteSystemSessionInvitationListener()

初始化 RemoteSystemSessionInvitationListener 的实例。

事件

InvitationReceived

检测到来自另一设备的远程会话邀请时引发。

适用于