ZForge.Motion.Controls.CameraView.Start C# (CSharp) Method

Start() public method

public Start ( ) : void
return void
        public void Start()
        {
            if (false == this.CameraClass.ValidCheck(true))
            {
                return;
            }
            this.Cursor = Cursors.WaitCursor;
            try
            {
                CameraViewBeforeStartEventArgs e = new CameraViewBeforeStartEventArgs(this.Status, this);
                OnCameraViewBeforeStartEvent(e);
                if (e.Cancel == false)
                {
                    OnCameraViewLog(new CameraViewLogEventArgs(ZForge.Controls.Logs.LogLevel.LOG_INFO, string.Format(Translator.Instance.T("启动摄像头[{0}]."), this.CameraClass.Name), this));
                    AForge.Video.IVideoSource source = this.CameraClass.VideoSource;
                    if (source == null)
                    {
                        throw new System.NullReferenceException();
                    }
                    OpenVideoSource(source);
                    this.SetStatus(Motion.Core.CameraStatus.STOPPED, false);
                    this.SetStatus(Motion.Core.CameraStatus.STARTED, true);
                }
                e = null;
            }
            catch (Exception)
            {
                MessageBox.Show(string.Format(Translator.Instance.T("启动摄像头[{0}]失败!"), this.CameraClass.Name), MotionPreference.Instance.MessageBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                OnCameraViewLog(new CameraViewLogEventArgs(ZForge.Controls.Logs.LogLevel.LOG_ERROR, string.Format(Translator.Instance.T("启动摄像头[{0}]失败!"), this.CameraClass.Name), this));
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }