Exemplo n.º 1
0
        public override object Read()
        {
            try
            {
                VisionFitCircleParam tempvisionFitCircleParam = null;
                string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";
                //tempvisionFitCircleParam = (VisionFitCircleParam)AccessXmlSerializer.XmlToObject(strPath, visionFitCircleParam.GetType());
                strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".json";
                VisionFitCircircle fitCircircle = (VisionFitCircircle)AccessJosnSerializer.JsonToObject(strPath, this.GetType());
                if (fitCircircle != null && fitCircircle.visionFitCircleParam != null)
                {
                    visionFitCircleParam = tempvisionFitCircleParam = fitCircircle.visionFitCircleParam;
                }
                else
                {
                    _logger.Warn(m_strStepName + ": 视觉处理项目加载失败,请检查");
                    MessageBox.Show(m_strStepName + ": 视觉处理项目加载失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(null);
                }
                return(visionFitCircleParam);

                //object obj = new object();
                //string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".json";
                //AccessJosnSerializer.ObjectToJson(strPath,obj);
            }
            catch (Exception e)
            {
                _logger.Warn(m_strStepName + "读取失败:" + e.Message);
            }
            return(null);
        }
Exemplo n.º 2
0
 public override object Read(string strPath)
 {
     try
     {
         //  string strPath = VisionMgr.GetInstance().CurrentVisionProcessDir + "\\" + m_strStepName + "\\" + m_strStepName + ".xml";
         VisionFitCircleParam tempvisionFitCircleParam = (VisionFitCircleParam)AccessXmlSerializer.XmlToObject(strPath, visionFitCircleParam.GetType());
         if (tempvisionFitCircleParam != null)
         {
             visionFitCircleParam = tempvisionFitCircleParam;
         }
         else
         {
             _logger.Warn(m_strStepName + ": 视觉处理项目加载失败,请检查");
             MessageBox.Show(m_strStepName + ": 视觉处理项目加载失败,请检查", "Err", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(null);
         }
         return(visionFitCircleParam);
     }
     catch (Exception e)
     {
         _logger.Warn(m_strStepName + "读取失败:" + e.Message);
     }
     return(null);
 }