Наследование: CameraViewStatusChangedEventArgs
Пример #1
0
 protected virtual void OnCameraViewBeforeStartEvent(CameraViewBeforeStartEventArgs e)
 {
     if (this.EventBeforeStart != null)
     {
         EventBeforeStart(this, e);
     }
 }
Пример #2
0
 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;
     }
 }
Пример #3
0
 private void cameraViewTest_CameraViewBeforeStart(object sender, CameraViewBeforeStartEventArgs e)
 {
     e.Cancel = this.Camera.ValidCheck(true) ? false : true;
     if (!e.Cancel)
     {
         this.cameraViewTest.CameraClass = this.Camera;
     }
 }
Пример #4
0
 private void cameraViewTest_CameraViewBeforeStart(object sender, CameraViewBeforeStartEventArgs e)
 {
     e.Cancel = this.Camera.ValidCheck(true) ? false : true;
     if (!e.Cancel)
     {
         this.cameraViewTest.CameraClass = this.Camera;
     }
 }
Пример #5
0
 protected virtual void OnCameraViewBeforeStartEvent(CameraViewBeforeStartEventArgs e)
 {
     if (this.EventBeforeStart != null)
     {
         EventBeforeStart(this, e);
     }
 }
Пример #6
0
 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;
     }
 }