INGEAR.NET.GELink

 

DataChange Delegate

Represents a method that will handle a change in data

[Visual Basic]
Public Delegate Sub DataChange( _
   ByVal sender As Object, _
   ByVal e As DataChangeEventArgs _
)
[C#]
public delegate void DataChange(
   object sender,
   DataChangeEventArgs e
);

Parameters

sender
Instance of the Tag class that invoked the Changed event.
e
Data associated with the change.

Remarks

Change event will only fire when the Active property = true and under the following conditions:

ReadTag or GroupRead detects a change in the Value property Controller.ReadTag or Controller.GroupRead detects a change in the QualityCode property,

Example

VB
Dim MyPLC As New GELink.Controller("192.168.1.45")
Dim WithEvents MyTag As New GELink.Tag("%R1")
' * add the event handler
AddHandler MyTag.Changed,  AddressOf MyTag_Changed
' * Read the tag
MyPLC.ReadTag(MyTag)
' * Event Handler
Private Sub MyTag_Changed(ByVal sender As Object, ByVal e As GELink.DataChangeEventArgs) Handles Tag1.Changed)
  If e.QualityCode = ResultCode.QUAL_GOOD Then
    Console.WriteLine(e.Value.ToString())
  End If  
End Sub


 
C#
GELink.Controller MyPLC = new GELink.Controller("192.168.1.45");
GELink.Tag MyTag = new GELink.Tag("%R1")
// add the event handled
MyTag.Changed += new MyTag.ChangedEventHandler(MyTag_Changed);
 
// read the tag
MyPLC.ReadTag(myTag);
 
// event handler
void MyTag_Changed(ByVal sender As Object, ByVal e As GELink.DataChangeEventArgs) Handles Tag1.Changed)
{  
if( e.QualityCode == ResultCode.QUAL_GOOD)    
   Console.WriteLine(e.Value.ToString());
}
 

Namespace: GELink

Assembly: INGEAR.NET.GELink (in INGEAR.NET.GELink.dll)

See Also

GELink Namespace