A slightly different option is the one I use. I create 1 single ValueChanged event, or manually create a function with matching signature. Per your existing convention.
Code: Select all
void Station2_Mxxx_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
ScriptModule1.Start();
}
Now from the script editor for Tags you can right click each tag you wish to use this ValueChange event code, and "Hookup existing..."
![Hookup Event Handler](./download/file.php?id=379&sid=21202b089ba904bfa48a6b944558bda0)
- Hookup Event Handler
- Hookup ValueChange Evt Hndler.png (29.74 KiB) Viewed 8344 times
You can also cast "sender" to a GlobalDataItem if you want to gain access to the Tag's name, Gain, or Value for further specific function upon the change in value.
For Example, Assuming 4 Tags [Tag1 ... Tag4] are created, each assigned the same event handler.
Code: Select all
void Station2_Mxxx_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
GlobalDataItem tag = (GlobalDataItem)sender;
if(tag.Name.Equals("Tag2"))
MessageBox.Show("Tag2 Was Changed!");
}
You can now react to an individual condition (such as Name) depending on which tag was changed.
This is the methodology I use to create a central value change event handler and dispatch functionality to other Class Methods depending on the desired behavior I want.