Example #1
0
        private void btnSaveVPP_Click(object sender, EventArgs e)
        {
            string strFName;

            strFName = ASDef._INI_PATH + "\\Img\\" + AVisionProBuild.ToolName(m_nType, m_nPoint, m_aCalibCheckerboard.Name) + ".bmp";
            FileInfo fileDel = new FileInfo(strFName);

            if (fileDel.Exists)
            {
                fileDel.Delete();
            }

            // 2017.06.08
            //m_aCalibCheckerboard.Name = AVisionProBuild.MakeName("CalibCheckerboard", DateTime.Now);

            AVisionProBuild.SaveVpp(m_nType);

            strFName = ASDef._INI_PATH + "\\Img\\" + AVisionProBuild.ToolName(m_nType, m_nPoint, m_aCalibCheckerboard.Name) + ".bmp";
            // 2012.01.17
            //AVisionProBuild.SaveImg(strFName, cogDisplay);
            AVisionProBuild.SaveImg(strFName, m_cogImage);

            // 2012.04.24
#if (!_USE_BASLER_PYLON && !_USE_IMAGING_CONTROL)
            /* 2015.10.18
             * if (m_aAcqFifo.AcqFifoTool.Operator != null)
             * {
             *  // 2013.05.15
             *  if (m_aAcqFifo.GetFrameGrabberName().Contains("acA2500"))
             *  {
             *      AIniExposure aIniExposure = new AIniExposure(m_nType, m_nPoint);
             *      aIniExposure.m_nExposure = Convert.ToInt64(txtExposure.Text);
             *      aIniExposure.Write();
             *  }
             * }
             */
#elif _USE_BASLER_PYLON
            AIniExposure aIniExposure = new AIniExposure(m_nType, m_nPoint);
            // 2015.12.09
            aIniExposure.m_dExposure = Convert.ToDouble(txtExposure.Text);
            if (aIniExposure.m_dExposure > 0)
            {
                aIniExposure.Write();
            }
#endif
            // 2014.10.30
#if _USE_1Camera
            CogSerializer.SaveObjectToFile(m_aAcqFifo.GetTool(), ASDef._INI_PATH + "\\1Camera.vpp", typeof(System.Runtime.Serialization.Formatters.Binary.BinaryFormatter), CogSerializationOptionsConstants.Minimum);
#endif

            //MessageBox.Show("Tool is Saved!");
            // 2013.12.02
            MessageBox.Show(AUtil.GetXmlLanguage("Tool_is_Saved"));
            btnSaveVPP.Enabled = false;
        }
        private void btnSaveVPP_Click(object sender, EventArgs e)
        {
            string strFName;

            strFName = ASDef._INI_PATH + "\\Img\\" + AVisionProBuild.ToolName(m_nType, m_nPoint, m_aFindEllipse.Name) + ".bmp";
            FileInfo fileDel = new FileInfo(strFName);

            if (fileDel.Exists)
            {
                fileDel.Delete();
            }

            m_aFindEllipse.Name = AVisionProBuild.MakeName("FindEllipse", DateTime.Now);
            AVisionProBuild.SaveVpp(m_nType);

            strFName = ASDef._INI_PATH + "\\Img\\" + AVisionProBuild.ToolName(m_nType, m_nPoint, m_aFindEllipse.Name) + ".bmp";
            AVisionProBuild.SaveImg(strFName, m_cogImage);

            // 2014.03.31
            m_aIni.Write();
            // 2012.04.24
#if (!_USE_BASLER_PYLON && !_USE_IMAGING_CONTROL)
            /* 2015.10.18
             * if (m_aAcqFifo.AcqFifoTool.Operator != null)
             * {
             *  // 2013.05.15
             *  if (m_aAcqFifo.GetFrameGrabberName().Contains("acA2500"))
             *  {
             *      AIniExposure aIniExposure = new AIniExposure(m_nType, m_nPoint);
             *      aIniExposure.m_nExposure = Convert.ToInt64(txtExposure.Text);
             *      // 2013.07.22
             *      if (aIniExposure.m_nExposure > 0)
             *          aIniExposure.Write();
             *  }
             * }
             */
#elif _USE_BASLER_PYLON
            AIniExposure aIniExposure = new AIniExposure(m_nType, m_nPoint);
            // 2015.12.09
            aIniExposure.m_dExposure = Convert.ToDouble(txtExposure.Text);
            if (aIniExposure.m_dExposure > 0)
            {
                aIniExposure.Write();
            }
#endif
            MessageBox.Show("Vpp is Saved!");
        }