Ejemplo n.º 1
0
        /// <summary>
        /// Constructor of GUI form
        /// </summary>
        /// <param name="selectedWebcam">WebcamLibrary object from which NewFrameImageEvents come</param>
        public GUI(Arsalis.WebcamLibrary.WebcamLibrary selectedWebcam)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            // optimise display speed in order to avoid flicker
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            this.webcam       = selectedWebcam;
            this.ConsoleBuddy = this.webcam.ConsoleBuddy;
            // TODO check if VideoResolution can be set all the time at initialisation
            // of WebcamLibrary or define a new parameter in WebcamLibrary


            try
            {
                if (this.webcam.videoDeviceForCapture.VideoResolution != null)
                {
                    this.pictureBox1.Size = this.webcam.videoDeviceForCapture.VideoResolution.FrameSize;
                }
            }
            catch (SystemException ex)
            {
                ConsoleBuddy.WriteException(ex, "GUI(Arsalis.WebcamLibrary.WebcamLibrary selectedWebcam)");
            }
            //this.OpenVideoSource( this.webcam.videoDeviceForCapture);
            //this.webcam.startWebcam(0);
            //this.videoSourcePlayer1.Start();
        }
Ejemplo n.º 2
0
 void UnsubscribeToEvent(Arsalis.WebcamLibrary.WebcamLibrary webcam)
 {
     try
     {
         webcam.NewFrameImage -= this.GrabNewFrame;
         ConsoleBuddy.WriteLineYellow("Leave UnsubscribeToEvent...");
     }
     catch (SystemException sysEx)
     {
         ConsoleBuddy.WriteException(sysEx, "UnsubscribeToEvent");
     }
     catch (ApplicationException appEx)
     {
         ConsoleBuddy.WriteException(appEx, "UnsubscribeToEvent");
     }
 }