Exemple #1
0
 public void EventHandlershanshu(object ob, EventHandlerSendParm Param)
 {
     try
     {
         if (Param.Provider == null && ob != null)
         {
             Param.Provider = ob.ToString().Split(',')[0];
         }
         AddEvent2Xml(Param);
     }
     catch
     {
     }
 }
Exemple #2
0
        /// <summary>
        /// 添加日志入口
        /// </summary>
        /// <param name="Node0Str"></param>
        /// <param name="Node1Str"></param>
        /// <param name="Attributes_Provider"></param>
        /// <param name="Attributes_EventID"></param>
        /// <param name="Attributes_Level"></param>
        /// <param name="Attributes_Keywords"></param>
        /// <param name="Attributes_TimeCreated"></param>
        /// <param name="Attributes_EventData"></param>
        private void AddEvent2Xml(EventHandlerSendParm Param)
        {
            lock (LogXmlDoc_Lock)
            {
                int Node0index;

                if (Param.Node1NameIndex == (int)LogData.Node1Name.System_runing ||
                    Param.Node1NameIndex == (int)LogData.Node1Name.System_security)
                {
                    Node0index = (int)LogData.Node0Name.System;
                }
                else if (Param.Node1NameIndex == (int)LogData.Node1Name.Equipment_CNC ||
                         Param.Node1NameIndex == (int)LogData.Node1Name.Equipment_PLC ||
                         Param.Node1NameIndex == (int)LogData.Node1Name.Equipment_RFID ||
                         Param.Node1NameIndex == (int)LogData.Node1Name.Equipment_ROBOT)
                {
                    Node0index = (int)LogData.Node0Name.Equipment;
                }
                else
                {
                    Node0index = (int)LogData.Node0Name.Network;
                }
                LogXmlDoc.Element(LogDataNode0Name[(int)Node0Name.Root]).Element(
                    LogData.LogDataNode0Name[Node0index]).AddFirst(
                    new XElement(LogData.LogDataNode1Name[Param.Node1NameIndex],
                                 new XAttribute(LogDataNode2Attributes[(int)Node2Attributes.Level], LogData.LogDataNode2Level[Param.LevelIndex]),
                                 new XAttribute(LogDataNode2Attributes[(int)Node2Attributes.TimeCreated], DateTime.Now.ToString()),
                                 new XAttribute(LogDataNode2Attributes[(int)Node2Attributes.Provider], Param.Provider),
                                 new XAttribute(LogDataNode2Attributes[(int)Node2Attributes.EventID], Param.EventID),
                                 new XAttribute(LogDataNode2Attributes[(int)Node2Attributes.Keywords], Param.Keywords),
                                 new XAttribute(LogDataNode2Attributes[(int)Node2Attributes.EventData], Param.EventData)
                                 ));
            }
            SaveLogXmlDoc_Flag = true;
            SaveData2Xml_threaFucEvent.Set();
        }