Пример #1
0
 /// <summary>
 /// 添加项
 /// </summary>
 public bool AddOpcItem(ref string errMsg)
 {
     try
     {
         var groupName  = McConfig.Instance.OpcGroupName;
         var readItems  = BizHandle.Instance.readItems.Keys.ToArray();
         var writeItems = BizHandle.Instance.writeItems.Keys.ToArray();
         if (!opcClient.AddOpcItems(groupName, readItems, ref errMsg))
         {
             return(false);
         }
         if (!opcClient.AddOpcItems(groupName, writeItems, ref errMsg))
         {
             return(false);
         }
         return(true);
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         return(false);
     }
 }
Пример #2
0
 /// <summary>
 /// 添加项
 /// </summary>
 public bool AddOpcItem(ref string errMsg)
 {
     try
     {
         var items = BizHandle.Instance.alarmInfos.Keys.ToArray();
         if (!opcClient.AddOpcItems(groupName, items, ref errMsg))
         {
             return(false);
         }
         return(true);
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         return(false);
     }
 }