Opc.Ua.Com.Client.ComDaGroup.ModifyItem C# (CSharp) Method

ModifyItem() public method

Modifies the item.
public ModifyItem ( GroupItem item, int samplingInterval, float deadband, bool active ) : bool
item GroupItem The item.
samplingInterval int The sampling interval.
deadband float The deadband.
active bool if set to true [active].
return bool
        public bool ModifyItem(GroupItem item, int samplingInterval, float deadband, bool active)
        {
            // check if the item can be added to the group.
            if (m_samplingInterval != samplingInterval || m_deadband != deadband)
            {
                // check if the item needs to be removed from the group.
                if (m_items.Count > 1)
                {
                    item.Deleted = true;
                    return false;
                }

                // update active state.
                item.ActiveChanged = active != item.Active;
                item.Active = active;

                // update the group parameters.
                m_samplingInterval = samplingInterval;
                m_deadband = deadband;
                m_updateRequired = true;

                return true;
            }

            // undelete the item.
            item.Deleted = false;

            // update active state.
            item.ActiveChanged = active != item.Active;
            item.Active = active;

            // nothing to do - the group matches the item.
            return true;
        }