private void miConfigure_Click(object sender, EventArgs e)
        {
            var frmSettings = new frmSettings();

            if (frmSettings.ShowDialog(this) == DialogResult.OK)
            {
                if (videoObject != null)
                {
                    videoObject.SetFreeRangeGainIntervals(Settings.Default.FreeRangeGainIntervals);
                }
            }
        }
        private void ConnectToCamera()
        {
            var chooser = new ASCOM.Utilities.Chooser();

            chooser.DeviceType = VIDEO_DEVICE_TYPE;
            string progId = chooser.Choose(VIDEO_DRIVER_NAME);

            if (!string.IsNullOrEmpty(progId))
            {
                useVariantPixels = Settings.Default.VariantPixels;
                videoObject      = new VideoWrapper(new Video(progId));

                try
                {
                    Cursor = Cursors.WaitCursor;
                    videoObject.Connected = true;

                    if (videoObject.Connected)
                    {
                        if (videoObject.SupporstFreeStyleGain)
                        {
                            videoObject.SetFreeRangeGainIntervals(Settings.Default.FreeRangeGainIntervals);
                        }

                        imageWidth       = videoObject.Width;
                        imageHeight      = videoObject.Height;
                        pictureBox.Image = new Bitmap(imageWidth, imageHeight);

                        ResizeVideoFrameTo(imageWidth, imageHeight);
                    }
                }
                finally
                {
                    Cursor = Cursors.Default;
                }


                pictureBox.Width  = videoObject.Width;
                pictureBox.Height = videoObject.Height;

                UpdateCameraState(true);
            }
        }