Example #1
0
        void checkTestStatus(String testResult)
        {
            if (IsAutoModeCamera)
            {
                TimerCamaraCapture.Stop();
            }

            if (HotTabCamera.GetCameraCount() > 0)
            {
                if (mHotTabCamera != null)
                {
                    mHotTabCamera.Flash(0);
                }
                if (Is8MCameraUsed)
                {
                    Flash_8M(0);
                }
                else
                {
                    SetFlashOff();
                }
            }

            labelTestCameraName.Text = "None";

            pictureBoxPreview.Image  = null;
            pictureBoxPreview2.Image = null;

            buttonFAIL.Enabled = false;

            buttonFlash.Enabled         = false;
            buttonCapture.Enabled       = false;
            buttonPreviewTop.Enabled    = false;
            buttonPreviewBottom.Enabled = false;

            FreeResources();

            if (testResult.Equals("PASS"))
            {
                labelResult.ForeColor = Color.Green;
                labelResult.Text      = "PASS";
                result["result"]      = "PASS";
                result["EIPLog"]      = new JObject
                {
                    { "Camera", "PASS" },
                    { "Camera_Info", "PASS" }
                };
            }
            else
            {
                labelResult.ForeColor = Color.Red;
                labelResult.Text      = "FAIL";
                result["result"]      = "FAIL";
                result["EIPLog"]      = new JObject
                {
                    { "Camera", "FAIL" },
                    { "Camera_Info", testResult }
                };
            }

            File.WriteAllText(GetFullPath("result.json"), result.ToString());
            Thread.Sleep(200);
            File.Create(GetFullPath("completed"));
            if (!ShowWindow)
            {
                Exit();
            }
        }
Example #2
0
        void camera_Load(object sender, EventArgs e)
        {
            result["result"] = "FAIL";
            var jsonconfig = GetFullPath("config.json");

            if (!File.Exists(jsonconfig))
            {
                MessageBox.Show("config.json not founded");
                Exit();
            }

            dynamic jobject = JObject.Parse(File.ReadAllText(jsonconfig));

            ShowWindow                 = (bool)jobject.ShowWindow;
            CameraAmount               = (int)jobject.CameraAmount;
            IsAutoModeCamera           = (bool)jobject.IsAutoModeCamera;
            TimerIntervalCamaraCapture = (int)jobject.TimerIntervalCamaraCapture;
            ConfirmTagContextBarcode   = jobject.ConfirmTagContextBarcode.ToString();
            TestProduct                = jobject.TestProduct.ToString();
            IsFM08 = (bool)jobject.IsFM08;

            if (ShowWindow)
            {
                this.Opacity       = 100;
                this.ShowInTaskbar = true;
            }
            if (IsDebugMode)
            {
                Trace.WriteLine("Camera_Load, Is8MCameraUsed : " + Is8MCameraUsed);
            }

            TestCamera = 0; // 確認測試過的相機數是初始值的0, Winmate Kenkun modify on 2017/07/07

            if (IsDeveloperMode)
            {
                UpdateDeviceList();
            }
            else if (HotTabCamera.GetCameraCount() <= 0)
            {
                if (IsDebugMode)
                {
                    Trace.WriteLine("Camera Not Found");
                }
                comboBoxCameraDevices.Items.Add("Device Not Found");
                comboBoxCameraDevices.SelectedIndex = 0;
                checkTestStatus("Camera Not Found.");
                return;
            }
            else
            {
                FangtecCameraDLL.ALC_Initialization(0, "");  // About 1.3 Sec

                // 將Camera轉90度, 需搭配廠商提供的Rotation Driver
                if (TestProduct.Equals("FMB8") && !IsFM08)
                {
                    HotTabDLL.FangtecRotate090();                                        // 由於DLL改版, 只有FM10用, Winmate Kenkun modify on 2015/12/14
                }
                UpdateDeviceList();
            }

            if (IsAutoModeCamera)
            {
                if (IsDebugMode)
                {
                    Trace.WriteLine("Camera - AutoMode");
                }
                groupBoxCapturePreview.Visible    = false;
                groupBoxPositionOfCapture.Visible = false;
                CaptureDecoder = new decoder();
            }
        }