Table of Contents

Class AdvancedHandler<THandler, TArgs>

Namespace
CMS.Base
Assembly
CMS.Base.dll

Represents a compound event consisting of Before and After event handling stages.

public abstract class AdvancedHandler<THandler, TArgs> : AbstractAdvancedHandler where THandler : AdvancedHandler<THandler, TArgs>, new() where TArgs : CMSEventArgs, new()

Type Parameters

THandler
TArgs
Inheritance
object
AdvancedHandler<THandler, TArgs>
Derived
Inherited Members
Extension Methods

Remarks

For commenced events which fail to complete, the registered Failure event handlers are invoked.

Properties

Allow

If true, the event is allowed to be raised

[Obsolete("Property is no longer used by the system and will be removed.")]
[ObsoleteSince(30, 2)]
public bool Allow { get; set; }

Property Value

bool

Continue

Specifies whether the context of execution should continue. If set to false, no additional events will be fired.

[Obsolete("Property is no longer used by the system and will be removed.")]
[ObsoleteSince(30, 2)]
protected override sealed bool Continue { get; set; }

Property Value

bool

EventArguments

Handler arguments

[Obsolete("Property is no longer used by the system and will be removed.")]
[ObsoleteSince(30, 2)]
public TArgs EventArguments { get; protected set; }

Property Value

TArgs

IsBound

Returns true if the handler has some events bound

public bool IsBound { get; }

Property Value

bool

IsInitiallyCancelable

Indicates whether the event is commenced in a state when it can be canceled.

protected virtual bool IsInitiallyCancelable { get; }

Property Value

bool

Remarks

By default event handlers are cancelable. Override this member to create the event handler as not cancelable.

Event cancellation can also be prevented after executing the Before stage using the PreventCancellation() method.

Parent

Parent handler

public THandler Parent { get; set; }

Property Value

THandler

SupportsCancel

If true, the handler supports cancelling of the event. If set and handler is already cancelled, throws an exception.

[Obsolete("Property is no longer used by the system and will be removed.")]
[ObsoleteSince(30, 2)]
protected override sealed bool SupportsCancel { get; set; }

Property Value

bool

WasFinished

Flag indicating whether the event was finished or not

[Obsolete("Property is no longer used by the system and will be removed.")]
[ObsoleteSince(30, 2)]
protected bool WasFinished { get; set; }

Property Value

bool

Methods

AddAfter()

Adds the conditional after handler

public ConditionalEvent<TArgs> AddAfter()

Returns

ConditionalEvent<TArgs>

AddBefore()

Adds the conditional before handler

public BeforeConditionalEvent<TArgs> AddBefore()

Returns

BeforeConditionalEvent<TArgs>

AddFailure()

Adds the conditional after handler

public ConditionalEvent<TArgs> AddFailure()

Returns

ConditionalEvent<TArgs>

CheckContinue()

Checks whether the action can continue and if not, fires an exception.

[Obsolete("Method is no longer used by the system and will be removed.")]
[ObsoleteSince(30, 2)]
protected void CheckContinue()

Clear()

Clears all bound event handlers from the event and resets the number of executions of the event

public override void Clear()

Dispose()

Disposes the object

public override void Dispose()

Finish()

Finishes the event and raises the After event actions

[Obsolete("Method is no longer used by the system and will be removed.")]
[ObsoleteSince(30, 2)]
protected override void Finish()

RaiseAfter(TArgs)

Raises the after event

protected void RaiseAfter(TArgs e)

Parameters

e TArgs

Event arguments

RaiseBefore(TArgs)

Raises the before event

protected virtual void RaiseBefore(TArgs e)

Parameters

e TArgs

Event arguments

RaiseFailure(TArgs)

Raises the failure event

protected void RaiseFailure(TArgs e)

Parameters

e TArgs

Event arguments

SetParent(AbstractHandler)

Sets the parent event of the event

public override void SetParent(AbstractHandler parent)

Parameters

parent AbstractHandler

New parent event

Start(TArgs)

Commences the event by invoking the registered Before event handlers. Returns a handle for completing the event.

public IAdvancedEventHandle<TArgs> Start(TArgs e)

Parameters

e TArgs

Arguments to be passed to registered event handlers.

Returns

IAdvancedEventHandle<TArgs>

Returns a handle for completing the event.

See Also

StartEvent()

Initiates the new handler context

[Obsolete("Use Start(TArgs) instead.")]
[ObsoleteSince(30, 2)]
public THandler StartEvent()

Returns

THandler

StartEvent(EventArgs)

Initiates the new handler context

[Obsolete("Use Start(TArgs) instead.")]
[ObsoleteSince(30, 2)]
public THandler StartEvent(EventArgs e)

Parameters

e EventArgs

Event arguments

Returns

THandler

StartEvent(TArgs, bool)

Initiates the new handler context

[Obsolete("Use Start(TArgs) instead.")]
[ObsoleteSince(30, 2)]
public THandler StartEvent(TArgs e, bool allowEvent = true)

Parameters

e TArgs

Event arguments

allowEvent bool

If true, it is allowed to raise the event

Returns

THandler

Events

After

Raised after the event occurs

public event EventHandler<TArgs> After

Event Type

EventHandler<TArgs>

Before

Raised before the event occurs

public event EventHandler<TArgs> Before

Event Type

EventHandler<TArgs>

Failure

Raised in case the event handler didn't properly call finalization

public event EventHandler<TArgs> Failure

Event Type

EventHandler<TArgs>