Show / Hide Table of Contents

Class Event

Represents an event manageable by IEventTimer

Inheritance
System.Object
DisposableObject
ApplicationComponent
Event
DeleteFilesJob
Implements
IApplicationComponent
System.IDisposable
INamed
IExternallyParameterized
IConfigurable
ILocalizedTimeProvider
Inherited Members
ApplicationComponent.AllComponents
ApplicationComponent.GetAppComponentBySID(UInt64)
ApplicationComponent.GetAppComponentByCommonName(String)
ApplicationComponent.ComponentSID
ApplicationComponent.ComponentStartTime
ApplicationComponent.ComponentCommonName
ApplicationComponent.ComponentDirector
DisposableObject.DisposeAndNull<T>(T)
DisposableObject.DisposeStarted
DisposableObject.Disposed
DisposableObject.EnsureObjectNotDisposed()
DisposableObject.Dispose()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: NFX.Time
Assembly: NFX.dll
Syntax
public class Event : ApplicationComponent, IApplicationComponent, IDisposable, INamed, IExternallyParameterized, IConfigurable, ILocalizedTimeProvider

Constructors

Event(IEventTimer, IConfigSectionNode)

Declaration
public Event(IEventTimer timer, IConfigSectionNode config)
Parameters
Type Name Description
IEventTimer timer
IConfigSectionNode config

Event(IEventTimer, String, TimerEvent, Nullable<TimeSpan>, IConfigSectionNode, EventBodyAsyncModel, Boolean)

Declaration
public Event(IEventTimer timer, string name = null, TimerEvent body = null, TimeSpan? interval = default (TimeSpan? ), IConfigSectionNode config = null, EventBodyAsyncModel bodyAsyncModel = EventBodyAsyncModel.AsyncTask, bool enabled = true)
Parameters
Type Name Description
IEventTimer timer
System.String name
TimerEvent body
System.Nullable<System.TimeSpan> interval
IConfigSectionNode config
EventBodyAsyncModel bodyAsyncModel
System.Boolean enabled

Fields

CONFIG_EVENT_SECTION

Declaration
public const string CONFIG_EVENT_SECTION = "event"
Field Value
Type Description
System.String

CONFIG_HANDLER_SECTION

Declaration
public const string CONFIG_HANDLER_SECTION = "handler"
Field Value
Type Description
System.String

EventHandler

References event handler that handles events. If it is null then only delegate events are called

Declaration
public IEventHandler EventHandler
Field Value
Type Description
IEventHandler

m_Lock

Declaration
protected readonly object m_Lock
Field Value
Type Description
System.Object

Properties

BodyAsyncModel

Defines how event body should be invoked

Declaration
[Config]
[ExternalParameter(new string[]{"time"})]
public virtual EventBodyAsyncModel BodyAsyncModel { get; set; }
Property Value
Type Description
EventBodyAsyncModel

CallCount

Returns how many times this event was called

Declaration
public int CallCount { get; }
Property Value
Type Description
System.Int32

Context

Adds arbitrary context object to the event

Declaration
[Config]
[ExternalParameter(new string[]{"time"})]
public object Context { get; set; }
Property Value
Type Description
System.Object

Enabled

Specifies whether this event will fire/participate in timer loop

Declaration
[Config]
[ExternalParameter(new string[]{"time"})]
public bool Enabled { get; set; }
Property Value
Type Description
System.Boolean

EndDate

Specifies when this event will stop firing in the local event time

Declaration
[Config]
[ExternalParameter(new string[]{"time"})]
public DateTime? EndDate { get; set; }
Property Value
Type Description
System.Nullable<System.DateTime>

ExternalParameters

Returns named parameters that can be used to control this component

Declaration
public IEnumerable<KeyValuePair<string, Type>> ExternalParameters { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>>

Interval

Specifies how often event fires

Declaration
[Config]
[ExternalParameter(new string[]{"time"})]
public TimeSpan Interval { get; set; }
Property Value
Type Description
System.TimeSpan

LastCall

Returns when was this event called for the last time in the local event time

Declaration
public DateTime LastCall { get; }
Property Value
Type Description
System.DateTime

LastError

Returns the last exception thrown from event handler or nul if no error happened

Declaration
public Exception LastError { get; }
Property Value
Type Description
System.Exception

LocalizedTime

Returns current time localized per TimeLocation

Declaration
public DateTime LocalizedTime { get; }
Property Value
Type Description
System.DateTime

MaxCount

Specifies how many times this event can be called. If less or equal than zero then no limit is set

Declaration
[Config]
[ExternalParameter(new string[]{"time"})]
public int MaxCount { get; set; }
Property Value
Type Description
System.Int32

Name

Declaration
public string Name { get; }
Property Value
Type Description
System.String

StartDate

Specifies when this event will start firing in the local event time

Declaration
[Config]
[ExternalParameter(new string[]{"time"})]
public DateTime? StartDate { get; set; }
Property Value
Type Description
System.Nullable<System.DateTime>

Status

Declaration
public EventStatus Status { get; }
Property Value
Type Description
EventStatus

TimeLocation

Returns time location that this Event instance operates under.

Declaration
public TimeLocation TimeLocation { get; set; }
Property Value
Type Description
TimeLocation

Timer

Declaration
public IEventTimer Timer { get; }
Property Value
Type Description
IEventTimer

Methods

AdjustDate(Nullable<DateTime>)

Adjusts date time Localized time

Declaration
protected DateTime? AdjustDate(DateTime? date)
Parameters
Type Name Description
System.Nullable<System.DateTime> date
Returns
Type Description
System.Nullable<System.DateTime>

Configure(IConfigSectionNode)

Declaration
public virtual void Configure(IConfigSectionNode config)
Parameters
Type Name Description
IConfigSectionNode config

Destructor()

Declaration
protected override void Destructor()
Overrides
ApplicationComponent.Destructor()

DoFire()

Declaration
protected virtual void DoFire()

DoHandleError(Exception)

Declaration
protected virtual void DoHandleError(Exception error)
Parameters
Type Name Description
System.Exception error

DoVisit(DateTime)

Override to perform extra status checks

Declaration
protected virtual bool DoVisit(DateTime localNow)
Parameters
Type Name Description
System.DateTime localNow
Returns
Type Description
System.Boolean

ExternalGetParameter(String, out Object, String[])

Gets external parameter value returning true if parameter was found

Declaration
public bool ExternalGetParameter(string name, out object value, params string[] groups)
Parameters
Type Name Description
System.String name
System.Object value
System.String[] groups
Returns
Type Description
System.Boolean

ExternalParametersForGroups(String[])

Returns named parameters that can be used to control this component

Declaration
public IEnumerable<KeyValuePair<string, Type>> ExternalParametersForGroups(params string[] groups)
Parameters
Type Name Description
System.String[] groups
Returns
Type Description
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Type>>

ExternalSetParameter(String, Object, String[])

Sets external parameter value returning true if parameter was found and set

Declaration
public bool ExternalSetParameter(string name, object value, params string[] groups)
Parameters
Type Name Description
System.String name
System.Object value
System.String[] groups
Returns
Type Description
System.Boolean

Fire(Boolean)

Calls event regardless of any constraints. Invokes a handler right away if syncInvoke is true or BodyAsyncModel is Sync, otherwise queues the task on a thread pool either as a regular or long-running task depending on BodyAsyncModel

Declaration
public void Fire(bool syncInvoke = false)
Parameters
Type Name Description
System.Boolean syncInvoke

LocalizedTimeToUniversalTime(DateTime)

Converts localized time to UTC time as of TimeLocation property

Declaration
public DateTime LocalizedTimeToUniversalTime(DateTime local)
Parameters
Type Name Description
System.DateTime local
Returns
Type Description
System.DateTime

ResetCallCount()

Resets call count counter. If this event has expired it will eventually transition to Started state. Keep in mind that it may expire again if EndDate is set and past due

Declaration
public void ResetCallCount()

UniversalTimeToLocalizedTime(DateTime)

Converts universal time to local time as of TimeLocation property

Declaration
public DateTime UniversalTimeToLocalizedTime(DateTime utc)
Parameters
Type Name Description
System.DateTime utc
Returns
Type Description
System.DateTime

VisitAndCheck(DateTime)

Invoked by timer, checks all conditions and fires/expires event depending on the status. Returns true if event was fired, false otherwise

Declaration
protected bool VisitAndCheck(DateTime utcNow)
Parameters
Type Name Description
System.DateTime utcNow
Returns
Type Description
System.Boolean

Events

Body

Event body that gets called when the event is due. The body is always invoked ASYNCHRONOUSLY unless Fire(syncronous=true) is called in which case it gets called on a thread that called Fire(true)

Declaration
public event TimerEvent Body
Event Type
Type Description
TimerEvent

DefinitionChange

Invoked when one of timer event definition parameters changes. Always called synchronously on the same thread that made a change. Subscribers should not block for long

Declaration
public event TimerEventDefinitionChange DefinitionChange
Event Type
Type Description
TimerEventDefinitionChange

StatusChange

Invoked when timer event status changes. Always called synchronously by the timer thread. Subscribers should not block for long

Declaration
public event TimerEventStatusChange StatusChange
Event Type
Type Description
TimerEventStatusChange

Implements

IApplicationComponent
System.IDisposable
INamed
IExternallyParameterized
IConfigurable
ILocalizedTimeProvider

Extension Methods

MiscUtils.NonNull<T>(T, Func<Exception>, String)
ObjectValueConversion.AsString(Object, String, ConvertErrorHandling)
ObjectValueConversion.AsNonNullOrEmptyString(Object)
ObjectValueConversion.AsLaconicConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsJSONConfig(Object, ConfigSectionNode, String, ConvertErrorHandling)
ObjectValueConversion.AsXMLConfig(Object, ConfigSectionNode, ConvertErrorHandling)
ObjectValueConversion.AsChar(Object, Char, ConvertErrorHandling)
ObjectValueConversion.AsNullableChar(Object, Nullable<Char>, ConvertErrorHandling)
ObjectValueConversion.AsByte(Object, Byte, ConvertErrorHandling)
ObjectValueConversion.AsNullableByte(Object, Nullable<Byte>, ConvertErrorHandling)
ObjectValueConversion.AsSByte(Object, SByte, ConvertErrorHandling)
ObjectValueConversion.AsNullableSByte(Object, Nullable<SByte>, ConvertErrorHandling)
ObjectValueConversion.AsShort(Object, Int16, ConvertErrorHandling)
ObjectValueConversion.AsNullableShort(Object, Nullable<Int16>, ConvertErrorHandling)
ObjectValueConversion.AsUShort(Object, UInt16, ConvertErrorHandling)
ObjectValueConversion.AsNullableUShort(Object, Nullable<UInt16>, ConvertErrorHandling)
ObjectValueConversion.AsInt(Object, Int32, ConvertErrorHandling)
ObjectValueConversion.AsNullableInt(Object, Nullable<Int32>, ConvertErrorHandling)
ObjectValueConversion.AsUInt(Object, UInt32, ConvertErrorHandling)
ObjectValueConversion.AsNullableUInt(Object, Nullable<UInt32>, ConvertErrorHandling)
ObjectValueConversion.AsLong(Object, Int64, ConvertErrorHandling)
ObjectValueConversion.AsNullableLong(Object, Nullable<Int64>, ConvertErrorHandling)
ObjectValueConversion.AsULong(Object, UInt64, ConvertErrorHandling)
ObjectValueConversion.AsNullableULong(Object, Nullable<UInt64>, ConvertErrorHandling)
ObjectValueConversion.AsDouble(Object, Double, ConvertErrorHandling)
ObjectValueConversion.AsNullableDouble(Object, Nullable<Double>, ConvertErrorHandling)
ObjectValueConversion.AsFloat(Object, Single, ConvertErrorHandling)
ObjectValueConversion.AsNullableFloat(Object, Nullable<Single>, ConvertErrorHandling)
ObjectValueConversion.AsDecimal(Object, Decimal, ConvertErrorHandling)
ObjectValueConversion.AsNullableDecimal(Object, Nullable<Decimal>, ConvertErrorHandling)
ObjectValueConversion.AsBool(Object, Boolean, ConvertErrorHandling)
ObjectValueConversion.AsNullableBool(Object, Nullable<Boolean>, ConvertErrorHandling)
ObjectValueConversion.AsGUID(Object, Guid, ConvertErrorHandling)
ObjectValueConversion.AsNullableGUID(Object, Nullable<Guid>, ConvertErrorHandling)
ObjectValueConversion.AsDateTime(Object)
ObjectValueConversion.AsDateTime(Object, DateTime, ConvertErrorHandling)
ObjectValueConversion.AsNullableDateTime(Object, Nullable<DateTime>, ConvertErrorHandling)
ObjectValueConversion.AsGDID(Object)
ObjectValueConversion.AsGDID(Object, GDID, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDID(Object, Nullable<GDID>, ConvertErrorHandling)
ObjectValueConversion.AsGDIDSymbol(Object)
ObjectValueConversion.AsGDIDSymbol(Object, GDIDSymbol, ConvertErrorHandling)
ObjectValueConversion.AsNullableGDIDSymbol(Object, Nullable<GDIDSymbol>, ConvertErrorHandling)
ObjectValueConversion.AsTimeSpan(Object)
ObjectValueConversion.AsTimeSpan(Object, TimeSpan, ConvertErrorHandling)
ObjectValueConversion.AsNullableTimeSpan(Object, Nullable<TimeSpan>, ConvertErrorHandling)
ObjectValueConversion.AsEnum<TEnum>(Object, TEnum, ConvertErrorHandling)
ObjectValueConversion.AsNullableEnum<TEnum>(Object, Nullable<TEnum>, ConvertErrorHandling)
ObjectValueConversion.AsUri(Object, Uri, ConvertErrorHandling)
JSONExtensions.ToJSON(Object, JSONWritingOptions)
JSONExtensions.ToJSON(Object, TextWriter, JSONWritingOptions)
JSONExtensions.ToJSON(Object, Stream, JSONWritingOptions, Encoding)
ErlObject.ToErlObject(Object)
ErlObject.ToErlObject(Object, ErlTypeOrder, Boolean)
Back to top Copyright © 2006-2018 Agnicore Inc
Generated by DocFX