Edit

Share via


DeferrableEventArgs Class

A template class used for the event argument types for deferrals.

Syntax

template <typename TEventArgsInterface, typename TEventArgsClass>
class DeferrableEventArgs : public TEventArgsInterface;

Parameters

TEventArgsInterface
The interface type that declares the arguments for a deferred event.

TEventArgsClass
The class that implements TEventArgsInterface.

Members

Public Methods

Name Description
DeferrableEventArgs::GetDeferral Gets a reference to the Deferral object which represents a deferred event.
DeferrableEventArgs::InvokeAllFinished Called to indicate that all processing to handle a deferred event is complete.

Remarks

Instances of this class are passed to event handlers for deferred events. The template parameters represent an interface that defines the details of the event arguments for a specific type of deferred event, and a class that implements that interface.

The class appears as the first argument to an event handler for a deferred event. You can call the GetDeferral method to get the Deferral object from which you can get all the information about the deferred event. After completing the event handling, you should call Complete on the Deferral object. You should then call InvokeAllFinished at the end of the event handler method, which ensures that the completion of all deferred events is communicated properly.

Requirements

Header: event.h

Namespace: Microsoft::WRL

DeferrableEventArgs::GetDeferral

Gets a reference to the Deferral object which represents a deferred event.

HRESULT GetDeferral([out, retval] Windows::Foundation::IDeferral** result)

Parameters

result
A pointer that will reference the Deferral object when the call completes.

Return Value

S_OK if successful; otherwise, an HRESULT that indicates the error.

DeferrableEventArgs::InvokeAllFinished

Called to indicate that all processing to handle a deferred event is complete.

void InvokeAllFinished()

Remarks

You should call this method after the event source calls InvokeAll. Calling this method prevents further deferrals from being taken and forces the completion handler to execute if no deferrals were taken.