private int[] GetServerHandles(IEnumerable <IDaItem> items) { return(items.Select(_ => _serverHandles.GetOrAdd( _.ItemId, itemId => { var def = new OpcItemDefine { IsActive = true, ItemId = itemId, ClientHandle = _clientHandleSequence.GetNext() }; var results = _group.AddItems(new[] { def }); return results[0].ServerHandle; })) .ToArray()); }
public void Add(IDaItem item) { if (_group != null) { var def = new OpcItemDefine { IsActive = true }; var result = _group.AddItems(new[] { def }); _items.Add(new ItemClass { ClientHandle = def.ClientHandle, Item = item, ServerHandle = result[0].ServerHandle }); } else { _items.Add(new ItemClass { Item = item }); } }