共用方式為


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 來確認遠端系統平臺的存取權,才能為這個類別的事件設定處理常式 (的) (s) 。

建構函式

RemoteSystemSessionInvitationListener()

初始化 RemoteSystemSessionInvitationListener的實例。

事件

InvitationReceived

偵測到另一部裝置的遠端會話邀請時引發。

適用於