/// <summary>
        /// Manual Triggerring
        /// </summary>
        /// <param name="manualLive"></param>
        /// <returns></returns>
        public override object Acquire(bool manualLive)
        {
            if (_cogAcqFifo == null)
            {
                //if (SimFileName !="" && File.Exists(SimFileName))
                //{
                //    return Bitmap.FromFile(SimFileName);
                //}
                return(null);
            }

            ICogImage cogImage = null;

            StopLiveAllCameraWindows();
            if (ExternalTrigger)
            {
                if (!manualLive)
                {
                    TriggerMode = eTriggerMode.Idle;
                }
                _waitForImage.Reset();
                FireTrigger();
                try
                {
                    // Wait for response
                    U.BlockOrDoEvents(_waitForImage, 2000);
                    cogImage = _lastCogImage;
                }
                catch (Exception ex)
                {
                    U.LogError(ex, "Image Acquisition error");
                }
            }
            else
            {
                try
                {
                    System.Threading.Thread.Sleep(1);
                    int ticket = -1;
                    lock (_lockAcqFifo)
                    {
                        ticket = _cogAcqFifo.StartAcquire();
                    }
                    cogImage = WaitForImage(ticket);
                }
                catch (Exception ex)
                {
                    U.LogError(ex, "Cognex Acquisition Error");
                }
                D.ObjectEventHandler delCallback = GetNextCallback();
                if (delCallback != null)
                {
                    delCallback(cogImage);
                }
            }
            AssignImageToWindows(cogImage);

            return(cogImage);
        }
 /// <summary>
 /// Auto-Triggerring
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CogAcqFifo_Complete(object sender, CogCompleteEventArgs e)
 {
     lock (_lockFifoComplete)
     {
         _lastCogImage = null;
         try
         {
             do
             {
                 Stopwatch sw       = Stopwatch.StartNew();
                 ICogImage cogImage = WaitForImage(-1);
                 if (cogImage == null)
                 {
                     return;
                 }
                 _lastCogImage = cogImage;
                 if (ShowImageInWindows)
                 {
                     AssignImageToWindows(cogImage);
                 }
                 D.ObjectEventHandler delCallback = GetNextCallback();
                 if (delCallback != null)
                 {
                     delCallback(_lastCogImage);
                 }
                 _waitForImage.Set();
             } while (true);
         }
         catch (Exception ex)
         {
             U.LogError(ex, "Error in obtaining image");
             System.Diagnostics.Debug.WriteLine(string.Format("Error in obtaining image {0}", Name));
         }
         _waitForImage.Set();
     }
 }