Microsoft DirectX 8.1 (C++) |
This topic applies to Windows XP Home Edition and Windows XP Professional only.
When a policy creates a denial and its associated tolls, the application must display them and enable the user to select tolls for payment. When you design the application's UI, consider the following points:
When a policy adds a toll to a denial, the CAManager fires a DenialTollAdded event. If a policy adds a secondary denial to a toll, the CAManager fires a TollDenialAdded event. It also fires events when a policy removes a toll or a denial. The application can use these events to keep its UI updated.
The user might need to resolve several denials, so toll payment happens in two stages:
In a typical application, the user will initiate these actions. For example, the application might call Select when the user clicks on a toll, and call PaySelectedTolls when the user clicks a "Pay Tolls" button. Use the CADenials.CountSelected property to determine whether the user has selected enough tolls to unblock the request.
The following example shows an outline of what to do. The details will depend on your application's UI.
' Respond to the toll-added event.
Private Sub mCAManager_DenialTollAdded( _
ByVal pDenial As MSTvCALib.ICADenial, _
ByVal pToll As MSTvCALib.ICAToll, _
ByVal cTolls As Long _
)
' Private method to display the toll.
UpdateUISomehow(pToll.Description(MSTvCALib.Short))
End Sub
' The user selected a toll.
Private Sub UserSelectedSomeToll(iToll As ICAToll)
iToll.Select (True)
Dim cSelected As Long
cSelected = mCAManager.ActiveRequest.Denials.CountSelected
PayTollsButton.Enabled = cSelected > 0
End Sub
' The user wants to pay the selected tolls.
Private Sub PayTollsButton_Click()
Dim CADenials As CADenials
Set CADenials = mCAManager.ActiveRequest.Denials
CADenials.PaySelectedTolls
End Sub
Refunding Paid Tolls
The CAManager keeps a collection of paid tolls. Whenever the user pays a toll, the owning policy copies that toll into the collection. The toll's ICAToll.Refundable property indicates whether the user can obtain a refund for the toll. The value depends on the implementation of the toll and the owning policy. If the toll is refundable, you can refund it by calling the ICAToll.RefundToll method.