using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SystemFramework;

namespace MisDataName
{
    public partial class SecondForm
    {

        void InitMainSignalEvent()
        {
            MisData.PlcChange = new PlcChangeEvent(MainSignalChange);
        }

        void MainSignalChange(OpcData.CustomeEvetnArgs msgEvent)
        {
            try
            {
                int tagType;
                string opName, tagValue;

                if (msgEvent.TagValue == null) return;
                tagType = Convert.ToInt32(msgEvent.TagType);
                opName = msgEvent.OpName.ToString();
                switch (Convert.ToInt32(msgEvent.TagValueType))
                {
                    case 11:
                        tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString();
                        break;
                    default:
                        tagValue = msgEvent.TagValue.ToString();
                        break;
                }

                if (Convert.ToInt32(msgEvent.TagValueType)==11)
                {

                    WriteWorkStationSignal(opName, tagType.ToString(), Convert.ToBoolean(Convert.ToInt32(tagValue)));
                }
                

            }
            catch (Exception err)
            {
                ApplicationLog.WriteLog(err, err.Message);

            }

        }


    }
}
