Exemplo n.º 1
0
        private void m_btnOpenCamera_Click(object sender, EventArgs e)
        {
            try
            {
                List <IGXDeviceInfo> listGXDeviceInfo = new List <IGXDeviceInfo>();
                m_objIGXFactory = IGXFactory.GetInstance();
                m_objIGXFactory.Init();
                m_objIGXFactory.UpdateAllDeviceList(200, listGXDeviceInfo);
                camera = new GxCamera();

                //ImageAlg testalg = new ImageAlg();
                //Order order = new Order();

                if (listGXDeviceInfo.Count <= 0)
                {
                    MessageBox.Show("未发现设备!");
                    //int[,] p = new int[,] { { 4, 2 }, { 1, 1 }, { 2, 5 }, { 6, 7 } };
                    //Point[] points = new Point[4];
                    //for (int i = 0; i < 4; i++)
                    //{
                    //    points[i].X = p[i, 0];
                    //    points[i].Y = p[i, 1];
                    //}
                    //Point[] sorted = ImageAlg.SortPoints(points);
                    return;
                }

                String strUserID = listGXDeviceInfo[0].GetUserID();

                camera.strUserID = strUserID;
                //camera = new GxCamera();

                /////////////////////////////////

                camera.OpenCamera(m_pic_ShowImage);
                m_btnCloseCamera.Focus();

                m_bIsOpen = true;
                UpdateUI();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }