예제 #1
0
        public object ReadParam()
        {
            object obj  = null;
            object obj2 = null;

            try
            {
                obj = AccessXmlSerializer.XmlToObject(AppDomain.CurrentDomain.BaseDirectory + @"config\COM_KEYENCE_Scanner" + ".xml", serialPortParam.GetType());
                if (obj != null)
                {
                    serialPortParam = (SerialPortParam)obj;
                }
                else
                {
                    Save();
                }
            }
            catch
            {
                obj = null;
            }
            if (obj == null)
            {
                MessageBox.Show("lingt control 串口 数据读取出错", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(obj);
        }
예제 #2
0
        public object ReadParam()
        {
            object obj = null;

            try
            {
                obj = AccessXmlSerializer.XmlToObject(AppDomain.CurrentDomain.BaseDirectory + @"\config\ElecCmp.xml", serialPortParam.GetType());
                if (obj != null)
                {
                    serialPortParam = (SerialPortParam)obj;
                }
                else
                {
                    Save();
                }
            }
            catch
            {
                obj = null;
            }
            if (obj == null)
            {
                MessageBox.Show("电抓  串口 数据读取出错", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(obj);
        }