Public Class TimerTest Private Property OutputProperty As IItemProperty ' the ItemProperty object for CustomItem.Output Private Property TimedCallbackService As ITimedCallbackService ' timer service Private Property TimerKey As Object ' will be != Nothing while timer is running ' Inputs Public Property Trigger As Boolean ' Outputs Public Property Out As Boolean Public Sub Execute(ByVal context As ICustomItemCallContext) If context.ChangedInputName = "Trigger" Then If OutputProperty Is Nothing Then ' Initialize OutputProperty if not yet done Dim propertyDescriptor As IItemPropertyDescriptor = context.Project.GetItemClassByName("CustomItem").GetPropertyByName("Output") OutputProperty = context.Item.GetProperty(propertyDescriptor) End If If TimedCallbackService Is Nothing Then ' Initialize TimedCallbackService if not yet done TimedCallbackService = DirectCast(context.Project, IServiceProvider).GetService(GetType(ITimedCallbackService)) End If If TimerKey Is Nothing Then ' Timer not already running ' start timer; will elapse in 1 second TimerKey = TimedCallbackService.Register(AddressOf DelayTimeElapsed, DateTime.UtcNow + TimeSpan.FromSeconds(1), Nothing) End If End If End Sub ' This method will be called one second after we got a pulse on the Trigger input Private Sub DelayTimeElapsed(ByVal timerKey As Object, ByVal data As Object) TimerKey = Nothing Out = Not Out ' flip Out ' Write directly to Server property, since the custom item element will ' pick up the Out property value only after calling Execute OutputProperty.Value = New Object(0) {Out} End Sub End Class