INGEAR.NET.Logix

 

Update Delegate

Indicates when a GroupRead or GroupWrite completes

[Visual Basic]
Public Delegate Sub Update( _
   ByVal sender As Object, _
   ByVal e As System.EventArgs _
)
[C#]
public delegate void Update(
   object sender,
  System.EventArgs e
);

Parameters

sender
Instance of TagGroup that invoked the event.
e
Arguments associated with the event

Example

VB
Try
  ' ****************************
  ' * initialize controller, group and tags
  Dim MyPLC As New Logix.Controller("192.168.1.31")
  Dim WithEvents MyGroup As New Logix.TagGroup
  Dim Tag1 As New Logix.Tag("MyIntTag")
  Dim Tag2 As New Logix.Tag("MyFloatTag")
  ' *****************************
  ' * add the event handler
   AddHandler MyGroup.Update,  AddressOf MyGroup_Update
  ' *****************************
  ' * add tags to group
  MyGroup.AddTag(Tag1)
  MyGroup.AddTag(Tag2)
  ' *****************************
  ' * Read the Group
  MyPLC.GroupRead(MyGroup)
Catch ex As System.Exception
  Console.WriteLine(ex.Message)
End Try
' **************************  
' * Event Handler
' **************************
Private Sub MyGroup_Update(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyGroup.Update
  Dim args As Logix.TagGroupEventArgs
  
  Try
    args = e  
    ' * what caused event
     Console.WriteLine(args.EventName)
  
     ' * process list of tags
     For Each (Logix.Tag theTag in args.TagList)
       If ResultCode.QUAL_GOOD = theTag.QualityCode Then
         Console.WriteLine(theTag.Name + "  " + theTag.Value.ToString() = "  " theTag.Value.ToString())
       Else
         Console.WriteLine(theTag.Name = "  " + theTag.QualityString)
       End If  
     Next  
  Catch ex As System.Exception
    Console.WriteLine(ex.Message)
  End Try    
End Sub


 
C# try {  ///////////////////////////////////////  // initialize controller, group and tags  Logix.Controller MyPLC = new Logix.Controller("192.168.1.31")  Logix.TagGroup MyGroup = new Logix.TagGroup();  Logix.Tag Tag1 = new Logix.Tag("MyIntTag");  Logix.Tag Tag2 = new Logix.Tag("MyFloatTag");  // add the event handler  MyGroup.GroupUpdate += new System.EventHandler(MyGroup_Update);  // read the tag  MyPLC.ReadTag(myTag); } catch(System.Exception ex) {  Console.WriteLine(ex.Message); } /////////////////////////////   // event handler void MyGroup_Update(object sender, System.EventArgs e) {  Logix.TagGroupEventArgs args = (Logix.TagGroupEventArgs) e;   try {   // process list of tags   foreach Logix.Tag theTag in args.TagList)   {     if(ResultCode.QUAL_GOOD == theTag.QualityCode)       Console.WriteLine(theTag.Name + "  " + theTag.Value.ToString() = "  " theTag.Value.ToString());     else          Console.WriteLine(theTag.Name = "  " + theTag.QualityString);   }     } catch (System.Exception ex) {     Console.WriteLine(ex.Message); }

Requirements

Namespace: Logix

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

See Also

Logix Namespace