Could someone shed some light to the the logic of the rapid data changing event triggering.
I have a PERS variable and have a subscribtion on the data changing.
Here it is:
private void rd_changed(object sender, DataValueChangedEventArgs e)
{
if (sender is RapidData)
{
MessageBox.Show(“RapidData has changed!”);
string rdName = ((RapidData)sender).Name;
Action method = _rapidsMap[rdName];
ControllerDataToComponent sgnToComponent = new ControllerDataToComponent();
sgnToComponent.dataValue = GetRapidData(rdName).ToString();
method.Invoke(sgnToComponent);
}
else
MessageBox.Show(“sender is not RapidData!”);
}
During the execution the value of the rapid variable changes many times, but I have no event triggering. Why? What I had missed? It works perfect with the signals…
Got your message so here I am
First here is an example which I ran just now which works, you need three buttons and a TpsLabel, and then the declaration of the ctrl and myRD needs to be at the top of the class declaration.
Sorry, had to do some other stuff in between. OK lets look at your code.
Can’t see your other stuff, so I really can’t say regarding your calls like _rapidsMap
In the event [rd_changed] you have code that make UI changes (MessageBox.Show) before the invoke. Wouldn’t it be better to just send along the sender and e and then do the strings and sgnToComponent execution in the invoked method. See Working with RAPID data and Controller events and threads
In my example above you see that I use that in the [myRD_ValueChanged], which invokes [ToTheLabel].
what do you use the delegate for?
Action
Can’t make sense of that.