コード例 #1
0
ファイル: DaClient.cs プロジェクト: simple555a/OpcDaClient
 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());
 }
コード例 #2
0
 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
         });
     }
 }