AgileEventSource 类

表示由敏捷组件引发的事件,敏捷组件是可从任何线程访问的组件。 继承自 EventSource 使用附加类型参数覆盖 Add 成员函数,用于指定如何调用敏捷事件的选项。

语法

template<
    typename TDelegateInterface,
    typename TEventSourceOptions = Microsoft::WRL::InvokeModeOptions<FireAll>
>
class AgileEventSource :
    public Microsoft::WRL::EventSource<
        TDelegateInterface, TEventSourceOptions>;

参数

TDelegateInterface
表示事件处理程序的委托的接口。

TEventSourceOptions
一个 InvokeModeOptions 结构,其 invokeMode 字段设置为 InvokeMode::StopOnFirstErrorInvokeMode::FireAll

备注

Windows 运行时中绝大多数组件都是敏捷组件。 有关详细信息,请参阅线程处理和封送处理 (C++/CX)

继承层次结构

EventSource

AgileEventSource

要求

标头:event.h

命名空间: Microsoft::WRL

成员

公共方法

名称 描述
AgileEventSource::Add Method 将指定的委托接口表示的敏捷事件处理程序追加到当前 AgileEventSource 对象的事件处理程序集。

AgileEventSource::Add Method

将指定的委托接口表示的事件处理程序追加到当前 EventSource 对象的事件处理程序集。

语法

HRESULT Add(
   _In_ TDelegateInterface* delegateInterface,
   _Out_ EventRegistrationToken* token
);

参数

delegateInterface
表示事件处理程序的委托对象的接口。

token
此操作完成后,返回一个表示事件的句柄。 将此令牌用作 Remove() 方法的参数,以放弃事件处理程序。

返回值

如果成功,则为 S_OK;否则为指示错误的 HRESULT。

另请参阅

Microsoft::WRL Namespace