/// <summary>
 /// 初始化狀態列事件
 /// </summary>
 /// <param name="viewPort"></param>
 /// <param name="viewController"></param>
 public bool Init(HWindowControl viewPort, HWndCtrl viewController, GrabImageWorkingMan camera)
 {
     bool success = true;
     try
     {
         setMessageStore();
         setWatchCoordinate(viewPort);
         setWachtZoomChanged(viewController);
         setWatchOperationModeChange(viewController);
         setWatchGrayLevel(viewPort, viewController);
         setWatchCameraStatus(camera);
     }
     catch (Exception ex)
     {
         success = false;
         Hanbo.Log.LogManager.Error("UC_StatusStrip Error");
         Hanbo.Log.LogManager.Error(ex);
     }
     return success;
 }
        private void initializeGrabImage()
        {
            _grabImageWorkingMan = DeviceController.GetGrabImageWorkingManInstance();

            if (_grabImageWorkingMan != null)
            {
                //擷取
                _grabImageWorkingMan.GrabImageChanged += On_CameraGrabImageChanged;

                //Exception
                _grabImageWorkingMan.GrabImageException += On_CameraException;

                //狀態
                _grabImageWorkingMan.On_GrabImageStatusChanged += On_CameraStatusChanged;

                //停止
                _grabImageWorkingMan.GrabImageStopped += On_CameraStopped;
            }
            else
            {
                //ToDo
            }
        }
        /// <summary>
        /// 初始化 GrabImageWorkingMan
        /// </summary>
        private static void initGrabImageWorkingMan()
        {
            var setting = ConfigurationManager.AppSettings["UsePylonDriver"] ?? "false";
            bool usePylonDriver;
            Boolean.TryParse(setting, out usePylonDriver);

            if (usePylonDriver)
            {
                _grabImageWorkingMan = new PylonGrabImageWorkingMan();
            }
            else
            {
                _grabImageWorkingMan = new GrabImageWorkingMan(_fgArgs);
            }
        }
 /// <summary>
 /// <para>***************</para>
 /// 設定 Camear 狀態
 /// <para>***************</para>
 /// </summary>
 /// <param name="camera"></param>
 private void setWatchCameraStatus(GrabImageWorkingMan camera)
 {
     if (camera != null)
     {
         camera.GrabImageStopped += (sender, e) =>
         {
             if (e.Cancelled)
             {
                 SetStatus(SystemStatusType.ConnectionStatus, Hanbo.Resources.Resource.Disconnected);
             }
         };
         camera.On_GrabImageStatusChanged += (sender, e) =>
         {
             var cameraConnStatus = Hanbo.Resources.Resource.Disconnected;
             var status = e.Status;
             switch (status.Stage)
             {
                 case GrabStage.Connected:
                 case GrabStage.ContinuouslyGrabbing:
                 case GrabStage.Grabbed:
                 case GrabStage.Grabbing:
                     cameraConnStatus = Hanbo.Resources.Resource.Connected;
                     break;
             }
             SetStatus(SystemStatusType.ConnectionStatus, cameraConnStatus);
         };
         camera.GrabImageException += (ex) =>
         {
             var hException = ex as HOperatorException;
             if (hException != null)
             {
                 var errorNumber = hException.GetErrorNumber();
                 if (errorNumber == 5312)
                 {
                     MessageBox.Show(Hanbo.Resources.Resource.Message_CameraIsOccupied);
                 }
             }
             AddMessage(ex.Message);
             //SetStatus(SystemStatusType.SystemMsg, ex.Message);
         };
     }
 }