Exemple #1
0
        private void lstvwCamera_Click(object sender, EventArgs e)
        {
            int nIndex = lstvwCamera.FocusedItem.Index;

            if (nIndex < 0)
            {
                return;
            }

            clsCAM_Info CameraInfo = (clsCAM_Info)lstvwCamera.Items[nIndex].Tag;

            txtName.Text         = CameraInfo.m_strName;
            txtSerialNumber.Text = CameraInfo.m_strSerialNumber;
            cmbPixelFormat.Text  = CameraInfo.m_strPixelFormat;
            //txtIPAddress.Text = ABaslerPylon.GetDeviceIPAddress(CameraInfo.m_strSerialNumber);
            //txtCameraType.Text = ABaslerPylon.GetDevFullName(CameraInfo.m_strSerialNumber);

            clsFrameGrabber grabber = clsCamera.GetFrameGrabberInfo(CameraInfo.m_strSerialNumber);

            if (grabber != null && grabber.m_Grabber != null && grabber.m_Grabber.OwnedGigEAccess != null)
            {
                txtIPAddress.Text  = grabber.m_Grabber.OwnedGigEAccess.CurrentIPAddress;
                txtCameraType.Text = grabber.m_Grabber.Name;
            }

            txtExposureTime.Text = CameraInfo.m_n64Exposure.ToString();
            txtContrast.Text     = CameraInfo.m_dContrast.ToString("0.0000");
            txtBrightness.Text   = CameraInfo.m_dBrightness.ToString("0.0000");
            txtTimeout.Text      = CameraInfo.m_nTimeout.ToString();

            txtName.Enabled = false;
            if (m_bSelectCamera == false)
            {
                txtSerialNumber.Enabled = true;
                btnOnlineCamera.Enabled = true;
                cmbPixelFormat.Enabled  = true;
                txtExposureTime.Enabled = true;
                txtContrast.Enabled     = true;
                txtBrightness.Enabled   = true;
                txtTimeout.Enabled      = true;
            }
            else
            {
                txtSerialNumber.Enabled = false;
                btnOnlineCamera.Enabled = false;
                cmbPixelFormat.Enabled  = false;
                txtExposureTime.Enabled = false;
                txtContrast.Enabled     = false;
                txtBrightness.Enabled   = false;
                txtTimeout.Enabled      = false;
            }

            m_nMode = 0;
        }
Exemple #2
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            int nIndex = lstvwCamera.FocusedItem.Index;

            if (nIndex < 0)
            {
                return;
            }

            clsCAM_Info CamInfo = (clsCAM_Info)lstvwCamera.Items[nIndex].Tag;

            if (CamInfo == null)
            {
                return;
            }

            m_strSerialNumber = CamInfo.m_strSerialNumber;

            Close();
        }
Exemple #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("삭제하시겠습니까?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            int nIndex = lstvwCamera.FocusedItem.Index;

            if (nIndex < 0)
            {
                return;
            }

            clsCAM_Info CamInfo = (clsCAM_Info)lstvwCamera.Items[nIndex].Tag;

            for (int i = 0; i < m_lstCamInfo.Count; i++)
            {
                if (m_lstCamInfo[i].m_strName == CamInfo.m_strName)
                {
                    m_lstCamInfo.RemoveAt(i);

                    lstvwCamera.Items.RemoveAt(nIndex);

                    m_bNeedUpdate = true;
                }
            }

            txtName.Enabled         = false;
            txtSerialNumber.Enabled = false;
            btnOnlineCamera.Enabled = false;
            cmbPixelFormat.Enabled  = false;
            txtExposureTime.Enabled = false;
            txtContrast.Enabled     = false;
            txtBrightness.Enabled   = false;
            txtTimeout.Enabled      = false;

            m_nMode = 0;
        }
Exemple #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("저장하시겠습니까?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            clsCAM_Info CamInfo = new clsCAM_Info();

            txtName.Text = txtName.Text.Trim();
            if (txtName.Text.Length == 0)
            {
                return;
            }
            txtSerialNumber.Text = txtSerialNumber.Text.Trim();
            if (txtSerialNumber.Text.Length == 0)
            {
                return;
            }
            cmbPixelFormat.Text = cmbPixelFormat.Text.Trim();
            if (cmbPixelFormat.Text.Length == 0)
            {
                return;
            }

            CamInfo.m_strName         = txtName.Text;
            CamInfo.m_strSerialNumber = txtSerialNumber.Text;
            CamInfo.m_strPixelFormat  = cmbPixelFormat.Text;
            CamInfo.m_n64Exposure     = Convert.ToInt64(txtExposureTime.Text);
            CamInfo.m_dContrast       = Convert.ToDouble(txtContrast.Text);
            CamInfo.m_dBrightness     = Convert.ToDouble(txtBrightness.Text);
            CamInfo.m_nTimeout        = Convert.ToInt32(txtTimeout.Text);

            try
            {
                if (m_nMode == 1) // add
                {
                    m_lstCamInfo.Add(CamInfo);

                    ListViewItem lstItem = new ListViewItem();
                    lstItem     = lstvwCamera.Items.Add(CamInfo.m_strName);
                    lstItem.Tag = m_lstCamInfo[m_lstCamInfo.Count - 1];

                    m_bNeedUpdate = true;
                }
                else // modify
                {
                    if (txtName.Text.Length == 0)
                    {
                        return;
                    }

                    for (int i = 0; i < m_lstCamInfo.Count; i++)
                    {
                        if (m_lstCamInfo[i].m_strName == CamInfo.m_strName)
                        {
                            m_lstCamInfo[i].m_strPixelFormat  = CamInfo.m_strPixelFormat;
                            m_lstCamInfo[i].m_strSerialNumber = CamInfo.m_strSerialNumber;
                            m_lstCamInfo[i].m_n64Exposure     = CamInfo.m_n64Exposure;
                            m_lstCamInfo[i].m_dContrast       = CamInfo.m_dContrast;
                            m_lstCamInfo[i].m_dBrightness     = CamInfo.m_dBrightness;
                            m_lstCamInfo[i].m_nTimeout        = CamInfo.m_nTimeout;

                            int nIndex = lstvwCamera.FocusedItem.Index;
                            if (nIndex >= 0)
                            {
                                lstvwCamera.Items[nIndex].Text = CamInfo.m_strName + " : " + CamInfo.m_strSerialNumber;
                            }

                            m_bNeedUpdate = true;
                        }
                    }
                }
            }
            catch
            {
            }

            //if (m_nMode == 1)
            {
                txtName.Enabled         = false;
                txtSerialNumber.Enabled = false;
                btnOnlineCamera.Enabled = false;
                cmbPixelFormat.Enabled  = false;
                txtExposureTime.Enabled = false;
                txtContrast.Enabled     = false;
                txtBrightness.Enabled   = false;
                txtTimeout.Enabled      = false;

                m_nMode = 0;
            }
        }