ServiceRequestedEventArgs 类

定义

包含请求服务时 MediaProtectionManager 对象的事件数据。

public ref class ServiceRequestedEventArgs sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ServiceRequestedEventArgs final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ServiceRequestedEventArgs
Public NotInheritable Class ServiceRequestedEventArgs
继承
Object Platform::Object IInspectable ServiceRequestedEventArgs
属性

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

示例

以下示例演示如何创建 MediaProtectionManager、设置 Properties 属性,以及为 ComponentLoadFailedServiceRequested 添加事件侦听器。 有关完整示例,请参阅 如何使用可插入 DRM 主题。 '''javascript

mediaProtectionManager = 新的 Windows.Media.Protection.MediaProtectionManager () ;

function ServiceRequested (e) { logMsg (“Got Enabler - system/type: {” + e.request.protectionSystem + “}/{” + e.request.type + “}”) ;e.completion.complete (true) ;}

function ComponentLoadFailed (e) { logMsg (e.information.items.size.toString () + “failed components”) ; logMsg (”

组件:

");

列出 (var i = 0 的故障组件;i.information.items.size < ; i++) { logMsg (”

“ + e.information.items[i].name + ”

" + "

Reasons=0x“ + e.information.items[i].reasons.toString (16) + ”

Renewal Id=“ + e.information.items[i].renewalId) ;}

e.completion.complete (false) ;}

function RebootNeeded (e) { logMsg (“Reboot Required”) ; }

mediaProtectionManager.addEventListener (“servicerequested”, ServiceRequested, false) ;mediaProtectionManager.addEventListener (“componentloadfailed”, ComponentLoadFailed, false) ;mediaProtectionManager.addEventListener (“rebootneeded”, RebootNeeded, false) ;

注解

此对象不直接实例化。 它由 MediaProtectionManager.ServiceRequested 事件创建,作为参数返回到 ServiceRequestedEventHandler 委托。

属性

Completion

返回服务请求已完成的指示。

MediaPlaybackItem

获取与服务请求关联的 MediaPlaybackItem

Request

包含服务请求。

适用于