Example #1
0
 //从服务器中移除组
 public void RemoveGroup(SHHOPCGroup group)
 {
     if (_GroupList.Contains(group) == true)
     {
         group.DetachFromServer(this);
         _GroupList.Remove(group);
     }
 }
Example #2
0
 //添加组到服务器
 public void AddGroup(SHHOPCGroup group)
 {
     if (_GroupList.Contains(group) == false)
     {
         _GroupList.Add(group);
         group.AttachToServer(this);
     }
 }
Example #3
0
 //附加子项到组执行的操作
 internal void AttachToGroup(SHHOPCGroup group)
 {
     try
     {
         this.Group = group;
         if (group.OPCGroup != null)//OPC组已经连接上了
         {
             _OPCItem = group.OPCGroup.OPCItems.AddItem(this.OPCItemID, this.GetHashCode());
         }
     }
     catch
     { }
 }
Example #4
0
        internal void DetachFromGroup(SHHOPCGroup group)
        {
            try
            {
                if (_OPCItem != null)
                {
                    int[] arrayHandle = new int[1] {
                        _OPCItem.ServerHandle
                    };
                    Array arrayError;
                    group.OPCGroup.OPCItems.Remove(1, arrayHandle, out arrayError);
                }

                this.Group = null;

                _OPCItem = null;
            }
            catch
            { }
        }