public OpcGroup AddGroup(string groupName) { OpcGroup _group = new OpcGroup(); if (_groups.TryGetValue(groupName, out _group)) { return(_group); } else { _group = _client.AddGroup(groupName); _groups.Add(groupName, _group); return(_group); } }
/// <summary> /// 添加监控节点 /// </summary> /// <param name="groupName"></param> /// <param name="itemName"></param> /// <param name="msg">返回服务器上不存在items</param> /// <returns></returns> public OpcGroup AddItems(string groupName, string[] itemName, out string msg) { Result result; OpcGroup _group = new OpcGroup(); if (_groups.TryGetValue(groupName, out _group)) { result = _client.AddItems(groupName, itemName); } else { _client.AddGroup(groupName); result = _client.AddItems(groupName, itemName); _groups.Add(groupName, _group); } msg = result.UserData.ToString(); return(_group); }