//
        public GrabberEventViewModel Connect2()
        {
            var viewModel = new GrabberEventViewModel()
            {
                Result = new GrabberEventResult()
                {
                    State = GrabberEventState.Busy
                },
                ReportHandler = On_ConnectReport
            };
            HTuple acqHandle = null;

            try
            {
                acqHandle = getAcqHandle();
                viewModel.Result.State = GrabberEventState.Done;
            }
            catch (Exception ex)
            {
                viewModel.Result.Error = ex;
                Hanbo.Log.LogManager.Debug("Connect 2 Exception:" + ex.Message);
                Hanbo.Log.LogManager.Debug("Connect 2 StackTrace:" + ex.StackTrace);
            }
            finally
            {
                if (acqHandle != null)
                {
                    HOperatorSet.CloseFramegrabber(acqHandle);
                }
            }
            return(viewModel);
        }
        public GrabberEventViewModel SnapShot()
        {
            var viewModel = new GrabberEventViewModel()
            {
                Result = new GrabberEventResult()
                {
                    State = GrabberEventState.Busy
                },
                ReportHandler = On_ConnectReport
            };

            try
            {
                setHFramegrabber();

                _hFrameGrabber.GrabImageStart(_delay);
                var himage = _hFrameGrabber.GrabImage();
                viewModel.Result.State = GrabberEventState.Done;
            }
            catch (Exception ex)
            {
                viewModel.Result.Error = ex;
                Hanbo.Log.LogManager.Debug("SnapShot Exception:" + ex.Message);
                Hanbo.Log.LogManager.Debug("SnapShot StackTrace:" + ex.StackTrace);
            }
            finally
            {
                //c中斷
                if (_hFrameGrabber != null)
                {
                    _hFrameGrabber.Dispose();
                }
            }
            return(viewModel);
        }
        public GrabberEventViewModel Connect()
        {
            var viewModel = new GrabberEventViewModel()
            {
                Result = new GrabberEventResult()
                {
                    State = GrabberEventState.Busy,
                    Error = new Exception(),
                    Model = null
                },
                ReportHandler = On_ConnectReport
            };

            try
            {
                setHFramegrabber();

                viewModel.Result.State = GrabberEventState.Done;
            }
            catch (Exception ex)
            {
                viewModel.Result.Error = ex;
                Hanbo.Log.LogManager.Debug("Connect Exception:" + ex.Message);
                Hanbo.Log.LogManager.Debug("Connect StackTrace:" + ex.StackTrace);
            }
            finally
            {
                if (_hFrameGrabber != null)
                {
                    _hFrameGrabber.Dispose();
                }
            }
            return(viewModel);
        }
        /// <summary>
        /// HOperatorSet.GrabImage
        /// </summary>
        /// <returns></returns>
        public GrabberEventViewModel SnapShot2()
        {
            var viewModel = new GrabberEventViewModel()
            {
                Result = new GrabberEventResult()
                {
                    State = GrabberEventState.Busy
                },
                ReportHandler = On_ConnectReport
            };
            var     acqHandle = getAcqHandle();
            HObject himage;

            try
            {
                System.Console.WriteLine("Before HOperatorSet.GrabImageStart........");
                System.Console.WriteLine("Press anykey to Continue...." + DateTime.Now.ToString());
                Hanbo.Log.LogManager.Debug("Before GrabImage");
                System.Console.ReadKey();

                HOperatorSet.GrabImage(out himage, acqHandle);
                Hanbo.Log.LogManager.Debug("After GrabImage");
                System.Console.WriteLine("HOperatorSet.GrabImageAsync Done........");
                System.Console.WriteLine("Press anykey to Continue....");
                System.Console.ReadKey();
                viewModel.Result.State = GrabberEventState.Done;
            }
            catch (Exception ex)
            {
                viewModel.Result.Error = ex;
                Hanbo.Log.LogManager.Debug("SnapShot 2 Exception:" + ex.Message);
                Hanbo.Log.LogManager.Debug("SnapShot 2 StackTrace:" + ex.StackTrace);
            }
            finally
            {
                Hanbo.Log.LogManager.Debug("Finally Start ");
                if (acqHandle != null)
                {
                    HOperatorSet.CloseFramegrabber(acqHandle);
                }
                Hanbo.Log.LogManager.Debug("Finally End");
            }
            return(viewModel);
        }
Ejemplo n.º 5
0
        public GrabberEventViewModel Connect()
        {
            var viewModel = new GrabberEventViewModel()
            {
                Result = new GrabberEventResult()
                {
                    State = GrabberEventState.Busy,
                    Error = new Exception(),
                    Model = null
                },
                ReportHandler = On_ConnectReport
            };
            try
            {
                setHFramegrabber();

                viewModel.Result.State = GrabberEventState.Done;
            }
            catch (Exception ex)
            {
                viewModel.Result.Error = ex;
                Hanbo.Log.LogManager.Debug("Connect Exception:" + ex.Message);
                Hanbo.Log.LogManager.Debug("Connect StackTrace:" + ex.StackTrace);
            }
            finally
            {
                if (_hFrameGrabber != null)
                {
                    _hFrameGrabber.Dispose();
                }
            }
            return viewModel;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// HOperatorSet.GrabImage
        /// </summary>
        /// <returns></returns>
        public GrabberEventViewModel SnapShot2()
        {
            var viewModel = new GrabberEventViewModel()
            {
                Result = new GrabberEventResult()
                {
                    State = GrabberEventState.Busy
                },
                ReportHandler = On_ConnectReport
            };
            var acqHandle = getAcqHandle();
            HObject himage;
            try
            {
                System.Console.WriteLine("Before HOperatorSet.GrabImageStart........");
                System.Console.WriteLine("Press anykey to Continue...." + DateTime.Now.ToString());
                Hanbo.Log.LogManager.Debug("Before GrabImage");
                System.Console.ReadKey();

                HOperatorSet.GrabImage(out himage, acqHandle);
                Hanbo.Log.LogManager.Debug("After GrabImage");
                System.Console.WriteLine("HOperatorSet.GrabImageAsync Done........");
                System.Console.WriteLine("Press anykey to Continue....");
                System.Console.ReadKey();
                viewModel.Result.State = GrabberEventState.Done;
            }
            catch (Exception ex)
            {
                viewModel.Result.Error = ex;
                Hanbo.Log.LogManager.Debug("SnapShot 2 Exception:" + ex.Message);
                Hanbo.Log.LogManager.Debug("SnapShot 2 StackTrace:" + ex.StackTrace);
            }
            finally
            {
                Hanbo.Log.LogManager.Debug("Finally Start ");
                if (acqHandle != null)
                    HOperatorSet.CloseFramegrabber(acqHandle);
                Hanbo.Log.LogManager.Debug("Finally End");
            }
            return viewModel;
        }
Ejemplo n.º 7
0
        public GrabberEventViewModel SnapShot()
        {
            var viewModel = new GrabberEventViewModel()
            {
                Result = new GrabberEventResult()
                {
                    State = GrabberEventState.Busy
                },
                ReportHandler = On_ConnectReport
            };
            try
            {
                setHFramegrabber();

                _hFrameGrabber.GrabImageStart(_delay);
                var himage = _hFrameGrabber.GrabImage();
                viewModel.Result.State = GrabberEventState.Done;
            }
            catch (Exception ex)
            {
                viewModel.Result.Error = ex;
                Hanbo.Log.LogManager.Debug("SnapShot Exception:" + ex.Message);
                Hanbo.Log.LogManager.Debug("SnapShot StackTrace:" + ex.StackTrace);
            }
            finally
            {
                //c中斷
                if (_hFrameGrabber != null)
                {
                    _hFrameGrabber.Dispose();
                }
            }
            return viewModel;
        }
Ejemplo n.º 8
0
 //
 public GrabberEventViewModel Connect2()
 {
     var viewModel = new GrabberEventViewModel()
     {
         Result = new GrabberEventResult()
         {
             State = GrabberEventState.Busy
         },
         ReportHandler = On_ConnectReport
     };
     HTuple acqHandle = null;
     try
     {
         acqHandle = getAcqHandle();
         viewModel.Result.State = GrabberEventState.Done;
     }
     catch (Exception ex)
     {
         viewModel.Result.Error = ex;
         Hanbo.Log.LogManager.Debug("Connect 2 Exception:" + ex.Message);
         Hanbo.Log.LogManager.Debug("Connect 2 StackTrace:" + ex.StackTrace);
     }
     finally
     {
         if (acqHandle != null)
             HOperatorSet.CloseFramegrabber(acqHandle);
     }
     return viewModel;
 }