DataValueGetValueStruct Method |
Namespace: Demo3D.PLC.Comms
Calling this method may cause a delta to be applied to a base object, which may raise events (such as PropertyChanged or CollectionChanged). It's essential that events only get raised in the 'correct' thread, and specifically that user event handlers only get called in the user/model thread.
For data values passing downstream, the base object in the DataValue already has the delta applied, and so no events will be raised. It's safe to call GetValue at any point in the downstream data path.
For data values passing upstream, the base object is the previous value that was passed to the user and the delta contains the changes that have yet to be applied. GetValue applies the changes and raises any events. This normally happens when the actual value is retrieved by the model thread. This applies the deltas and fires the events in the model thread.
The only other place that GetValue can be called is in a DataConverter. It uses GetValue to get the value of the data which it then converts to another value. This works because the converter is a permanent fixture of the upstream data pathway, always converts values as they pass upstream, and no event handlers will be subscribed to the base value object.