Esempio n. 1
0
        private void cpvCameraControl_ValueChanged(object sender, EventArgs e)
        {
            AbstractCameraPropertyView control = sender as AbstractCameraPropertyView;

            if (control == null)
            {
                return;
            }

            string key = control.Tag as string;

            if (string.IsNullOrEmpty(key) || !cameraProperties.ContainsKey(key))
            {
                return;
            }

            CameraProperty property = control.Property;

            CameraPropertyManager.Write(device, cameraProperties[key]);

            specificChanged = true;

            /*
             * CameraPropertyView cpv = sender as CameraPropertyView;
             * if (cpv == null)
             *  return;
             *
             * CameraControlProperty? property = cpv.Tag as CameraControlProperty?;
             * if (property == null || !property.HasValue)
             *  return;
             *
             * CameraControlFlags flags = cpv.Property.Automatic ? CameraControlFlags.Auto : CameraControlFlags.Manual;
             * device.SetCameraProperty(property.Value, cpv.Property.Value, flags); */
        }
Esempio n. 2
0
        private void cpvCameraControl_ValueChanged(object sender, EventArgs e)
        {
            AbstractCameraPropertyView control = sender as AbstractCameraPropertyView;

            if (control == null)
            {
                return;
            }

            string key = control.Tag as string;

            if (string.IsNullOrEmpty(key) || !cameraProperties.ContainsKey(key))
            {
                return;
            }

            CameraPropertyManager.Write(deviceHandle, cameraProperties[key]);
            UpdateResultingFramerate();
            specificChanged = true;
        }
Esempio n. 3
0
        private void cpvCameraControl_ValueChanged(object sender, EventArgs e)
        {
            AbstractCameraPropertyView control = sender as AbstractCameraPropertyView;

            if (control == null)
            {
                return;
            }

            string key = control.Tag as string;

            if (string.IsNullOrEmpty(key) || !cameraProperties.ContainsKey(key))
            {
                return;
            }

            CameraPropertyManager.Write(specific, control.Property);
            specificChanged = true;
            FixWidth();
        }
Esempio n. 4
0
        private void AddCameraProperty(string key, string text, int top)
        {
            if (!cameraProperties.ContainsKey(key))
            {
                return;
            }

            CameraProperty property = cameraProperties[key];

            AbstractCameraPropertyView control = null;

            switch (property.Representation)
            {
            case CameraPropertyRepresentation.LinearSlider:
                control = new CameraPropertyViewLinear(property, text, null);
                break;

            case CameraPropertyRepresentation.LogarithmicSlider:
                control = new CameraPropertyViewLogarithmic(property, text, null);
                break;

            case CameraPropertyRepresentation.Checkbox:
                control = new CameraPropertyViewCheckbox(property, text);
                break;

            default:
                break;
            }

            if (control == null)
            {
                return;
            }

            control.Tag           = key;
            control.ValueChanged += cpvCameraControl_ValueChanged;
            control.Left          = 20;
            control.Top           = top;
            gbProperties.Controls.Add(control);
            propertiesControls.Add(key, control);
        }
Esempio n. 5
0
        private void cpvCameraControl_ValueChanged(object sender, EventArgs e)
        {
            AbstractCameraPropertyView control = sender as AbstractCameraPropertyView;

            if (control == null)
            {
                return;
            }

            string key = control.Tag as string;

            if (string.IsNullOrEmpty(key) || !cameraProperties.ContainsKey(key))
            {
                return;
            }

            CameraPropertyManager.Write(camera, deviceId, control.Property);

            // Dependencies:
            // - Pixel clock changes the range and current value of framerate.
            // - Framerate changes the range and current value of exposure.
            if (key == "height" || key == "width")
            {
                ReloadProperty("framerate");
                ReloadProperty("exposure");
            }
            else if (key == "pixelclock")
            {
                ReloadProperty("framerate");
                ReloadProperty("exposure");
            }
            else if (key == "framerate")
            {
                ReloadProperty("exposure");
            }

            specificChanged = true;
        }
        private bool AddCameraProperty(string key, string text, Func <int, string> valueMapper, int top)
        {
            if (!cameraProperties.ContainsKey(key))
            {
                return(false);
            }

            CameraProperty property = cameraProperties[key];

            AbstractCameraPropertyView control = null;

            switch (property.Representation)
            {
            case CameraPropertyRepresentation.LinearSlider:
                control = new CameraPropertyViewLinear(property, text, valueMapper);
                break;

            case CameraPropertyRepresentation.LogarithmicSlider:
                control = new CameraPropertyViewLogarithmic(property, text, valueMapper);
                break;

            default:
                break;
            }

            if (control == null)
            {
                return(false);
            }

            control.Tag           = key;
            control.ValueChanged += cpvCameraControl_ValueChanged;
            control.Left          = 20;
            control.Top           = top;
            groupBox1.Controls.Add(control);

            return(true);
        }