예제 #1
0
        /// <summary>
        /// Starts the camera.
        /// </summary>
        private void StartCam()
        {
            try
            {
                // Hide error (if any)
                lblCamError.Visible      = false;
                lblCamErrorTitle.Visible = false;
                lnkCamError.Visible      = false;
                picPreview.BackColor     = picSnapshot.BackColor;
                picPreview.Update();

                // Show status
                lblCamError.BackColor = picPreview.BackColor;
                lblCamError.Text      = "Connecting to Device - Please wait ...";
                lblCamError.Visible   = true;
                lblCamError.Update();

                // Get WebCam
                m_Cam = new CamTool(this);

                // Start preview
                try
                {
                    m_Cam.PreviewRate = int.Parse(txtPreviewRate.Text);
                }
                catch
                {
                    m_Cam.PreviewRate   = 60;
                    txtPreviewRate.Text = "60";
                }
                UpdateShowPreview();

                // Hide status
                lblCamError.Visible = false;
            }
            catch (CamException e)
            {
                m_Cam = null;
                lblCamError.Visible = false;

                lblCamErrorTitle.Text = e.Message;
                lblCamError.Text      = "Please check the device connection and make sure that the device is not being used by another application or user. Click the link below to try again.";

                picPreview.BackColor     = lblCamErrorTitle.BackColor;
                lblCamError.BackColor    = picPreview.BackColor;
                lnkCamError.Visible      = true;
                lblCamErrorTitle.Visible = true;
                lblCamError.Visible      = true;
            }
        }
예제 #2
0
        /// <summary>
        /// Starts the camera.
        /// </summary>
        private void StartCam()
        {
            try
            {
                // Hide error (if any)
                lblCamError.Visible = false;
                lblCamErrorTitle.Visible = false;
                lnkCamError.Visible = false;
                picPreview.BackColor = picSnapshot.BackColor;
                picPreview.Update();

                // Show status
                lblCamError.BackColor = picPreview.BackColor;
                lblCamError.Text = "Connecting to Device - Please wait ...";
                lblCamError.Visible = true;
                lblCamError.Update();

                // Get WebCam
                m_Cam = new CamTool(this);

                // Start preview
                try
                {
                    m_Cam.PreviewRate = int.Parse(txtPreviewRate.Text);
                }
                catch
                {
                    m_Cam.PreviewRate = 60;
                    txtPreviewRate.Text = "60";
                }
                UpdateShowPreview();

                // Hide status
                lblCamError.Visible = false;
            }
            catch(CamException e)
            {
                m_Cam = null;
                lblCamError.Visible = false;

                lblCamErrorTitle.Text = e.Message;
                lblCamError.Text = "Please check the device connection and make sure that the device is not being used by another application or user. Click the link below to try again.";

                picPreview.BackColor = lblCamErrorTitle.BackColor;
                lblCamError.BackColor = picPreview.BackColor;
                lnkCamError.Visible = true;
                lblCamErrorTitle.Visible = true;
                lblCamError.Visible = true;
            }
        }