Ejemplo n.º 1
0
        private bool SelectSource()
        {
            bool success = false;
            var vs = new VideoSource();
            vs.CameraControl = CameraControl;
            vs.ShowDialog(this);
            if (vs.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                CameraControl.Camobject.settings.videosourcestring = vs.VideoSourceString;
                CameraControl.Camobject.settings.sourceindex = vs.SourceIndex;
                CameraControl.Camobject.settings.login = vs.CameraLogin;
                CameraControl.Camobject.settings.password = vs.CameraPassword;
                CameraControl.Camobject.settings.useragent = vs.UserAgent;

                bool su = CameraControl.Camobject.resolution != vs.CaptureSize.Width + "x" + vs.CaptureSize.Height;
                if (vs.SourceIndex == 3)
                {
                    CameraControl.Camobject.resolution = vs.CaptureSize.Width + "x" + vs.CaptureSize.Height;
                    CameraControl.Camobject.settings.framerate = vs.FrameRate;
                    CameraControl.Camobject.settings.crossbarindex = vs.VideoInput.Index;
                }

                chkActive.Enabled = true;
                chkActive.Checked = false;
                Thread.Sleep(1000); //allows unmanaged code to complete shutdown
                chkActive.Checked = true;

                CameraControl.NeedSizeUpdate = su;
                success = true;
            }
            vs.Dispose();
            return success;
        }