Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Question about possibility of programmatically subscribe / unsubscribe property in live binding

More
21 Mar 2016 14:48 #3946 by support
This appears to be actually a "live mapping", not a "live binding" question.

The DAClientMapper object has following method that can be used:
public void Subscribe(bool active, [NotNull] IEnumerable<IDAClientMapping> mappings)

The 'active' flag indicates whether to subscribe or unsubscribe. This method accepts a list of mappings that should be affected. They may not be easy to obtain, and therefore, in addition, there are extension methods that allow various form of selecting the mappings:
static public void SubscribeTarget(
            [NotNull] this DAClientMapper clientMapper,
            bool active,
            [NotNull] Predicate<IEnumerable<string>> mappingTagsPredicate,
            [NotNull] object targetObject,
            bool recurse)

The above method enumerates all mapping on a target object (and possibly all below it, recursively), and you provide a predicate (a test) that for each of the mapping decides whether it should be affected or not.
static public void SubscribeTarget(
            [NotNull] this DAClientMapper clientMapper, 
            bool active,
            [NotNull] string mappingTag, 
            [NotNull] object targetObject, 
            bool recurse)

The above method selects the mapping based on mapping tags (read the doc - they can be specified using attributes as well).
static public void SubscribeTarget(
            [NotNull] this DAClientMapper clientMapper,
            bool active,
            [NotNull] object targetObject,
            bool recurse)

The above method affects all mapping on a given target object, without further distinction.

I hope this helps.
Best regards

Please Log in or Create an account to join the conversation.

  • miron
  • Topic Author
  • Visitor
  • Visitor
21 Mar 2016 11:32 #3944 by miron
Hi,
I have question, about possibility of programmatically subscribe / unsubscribe
C# property which was marked by "[DAItem(Operations = DAItemMappingOperations.Subscribe)]".

After mapping C# object I would like to unsubscribe / subscribe some chosen property
which was marked by this attribute [DAItem(Operations = DAItemMappingOperations.Subscribe)].

Is it possible?
How I could accomplish it?

Thank you.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.043 seconds