asked on
Public Class FormUpdateService
Private aTimer As System.Timers.Timer
Private theForm As Form
Public Sub SetupForm(ByVal currentForm As form)
aTimer = New System.Timers.Timer(10000)
AddHandler aTimer.Elapsed, AddressOf OnTimedEvent
aTimer.Interval = 1000
aTimer.Enabled = True
theForm = currentForm
SetButtons(theForm)
End Sub
Private Sub OnTimedEvent(ByVal source As Object, ByVal e As ElapsedEventArgs)
SetButtons(theForm)
End Sub
Public Sub CloseForm()
aTimer.Enabled = False
aTimer.Dispose()
End Sub
Private Sub SetButtons(ByVal currentForm As Form)
Dim localSystemSignals As SystemSignalsSingleton = SystemSignalsSingleton.GetSingleton
Dim fControl As Control
For Each fControl In currentForm.Controls
If (TypeOf fControl Is CheckBox) Then
Dim chBox As CheckBox
Dim signals As New List(Of IOItem)
Dim returnValue As New IOItem
chBox = fControl
signals = localSystemSignals.GetIOItems
For Each signal As IOItem In signals
If signal.ControlName = fControl.Tag Then
If signal.ActualSignalValue = 1 Then
chBox.Checked = True
End If
End If
Next
End If
Next fControl
End Sub
End Class
ASKER
Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,
TRUSTED BY
ASKER
Used
Delegate Sub SetButs(ByVal cForm As Form)
theForm.Invoke(New SetButs(AddressOf SetButtons), theForm)