public void AsynchReadListenerForEES(object sender, OPCDA.NET.RefreshEventArguments arg)
        {
            OPCDA.NET.OPCItemState res = arg.items[0].OpcIRslt;

            try
            {
                if (arg.Reason == OPCDA.NET.RefreshEventReason.DataChanged)
                {            // data changes
                    if (HRESULTS.Succeeded(res.Error))
                    {
                        OPCDA.NET.ItemDef opcItemDef = (OPCDA.NET.ItemDef)arg.items.GetValue(0);

                        string[] iterateItemName = opcItemDef.OpcIDef.ItemID.Split(new Char[] { '.' });
                        string   channel         = "";
                        string   machineName     = "";
                        string   tag_Name        = "";
                        if (iterateItemName.Length == 3)
                        {
                            channel     = iterateItemName[0].ToString();
                            machineName = iterateItemName[1].ToString();
                            tag_Name    = iterateItemName[2].ToString();

                            updateDataFromOpcListener = new Thread(delegate()
                            {
                                if (tag_Name.Equals(OpcTags.EES_Car_At_EES) || tag_Name.Equals(OpcTags.EES_OutDoor_NotClosed_LS))
                                {
                                    res.DataValue = GetCarAtEESStatus(channel, machineName);
                                }
                                UpdateMachineTagValueToDBFromListener(machineName, tag_Name, res.DataValue);
                            });
                            updateDataFromOpcListener.IsBackground = true;
                            updateDataFromOpcListener.Start();
                        }
                    }
                }
            }
            catch (Exception errMsg)
            {
            }
        }
Exemplo n.º 2
0
 public void AsynchReadListenerForPST(object sender, OPCDA.NET.RefreshEventArguments arg)
 {
     throw new NotImplementedException();
 }