Ejemplo n.º 1
0
        private void BtnReconnect_Click(object sender, EventArgs e)
        {
            SpecificInfo info = summary.Specific as SpecificInfo;

            if (info == null)
            {
                return;
            }

            info.StreamFormat     = this.selectedStreamFormat;
            info.CameraProperties = this.CameraProperties;
            summary.UpdateDisplayRectangle(Rectangle.Empty);
            CameraTypeManager.UpdatedCameraSummary(summary);

            disconnect();
            connect();

            SpecificInfo specific = summary.Specific as SpecificInfo;

            if (specific == null || specific.Device == null)
            {
                return;
            }

            device           = specific.Device;
            cameraProperties = CameraPropertyManager.Read(device);

            PopulateStreamFormat();
            RemoveCameraControls();
            PopulateCameraControls();
            UpdateResultingFramerate();
        }
Ejemplo n.º 2
0
        public FormConfiguration(CameraSummary summary, Action disconnect, Action connect)
        {
            this.summary    = summary;
            this.disconnect = disconnect;
            this.connect    = connect;

            InitializeComponent();
            tbAlias.AutoSize = false;
            tbAlias.Height   = 20;

            tbAlias.Text            = summary.Alias;
            lblSystemName.Text      = summary.Name;
            btnIcon.BackgroundImage = summary.Icon;
            btnReconnect.Text       = CameraLang.FormConfiguration_Reconnect;

            SpecificInfo specific = summary.Specific as SpecificInfo;

            if (specific == null || specific.Device == null)
            {
                return;
            }

            device           = specific.Device;
            cameraProperties = CameraPropertyManager.Read(device);
            if (cameraProperties.Count != specific.CameraProperties.Count)
            {
                specificChanged = true;
            }

            PopulateCameraControls();

            this.Text     = CameraLang.FormConfiguration_Title;
            btnApply.Text = CameraLang.Generic_Apply;
            UpdateResultingFramerate();
        }
Ejemplo n.º 3
0
        private void Open()
        {
            if (device != null)
            {
                Close();
            }

            bool open = false;

            try
            {
                device         = igxFactory.OpenDeviceBySN(summary.Identifier, GX_ACCESS_MODE.GX_ACCESS_EXCLUSIVE);
                featureControl = device.GetRemoteFeatureControl();
                DahengHelper.AfterOpen(featureControl);
                open = true;
            }
            catch
            {
                log.DebugFormat("Could not open Daheng device.");
            }

            if (!open)
            {
                return;
            }

            SpecificInfo specific = summary.Specific as SpecificInfo;

            if (specific == null)
            {
                return;
            }

            // Store the camera object into the specific info so that we can retrieve device informations from the configuration dialog.
            specific.Device = device;

            if (firstOpen)
            {
                // Grab current values.
                Dictionary <string, CameraProperty> cameraProperties = CameraPropertyManager.Read(device);
                specific.CameraProperties = cameraProperties;
            }
            else
            {
                CameraPropertyManager.WriteCriticalProperties(device, specific.CameraProperties);
            }

            try
            {
                stream = device.OpenStream(0);
            }
            catch
            {
                log.DebugFormat("Could not start Daheng device.");
            }
        }
Ejemplo n.º 4
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(device, control.Property);
            UpdateResultingFramerate();
            specificChanged = true;
        }
Ejemplo n.º 5
0
        private void Open()
        {
            if (device != null)
            {
                Close();
            }

            bool open = false;

            try
            {
                device         = igxFactory.OpenDeviceBySN(summary.Identifier, GX_ACCESS_MODE.GX_ACCESS_EXCLUSIVE);
                featureControl = device.GetRemoteFeatureControl();
                DahengHelper.AfterOpen(featureControl);
                open = true;
            }
            catch
            {
                log.DebugFormat("Could not open Daheng device.");
            }

            if (!open)
            {
                return;
            }

            SpecificInfo specific = summary.Specific as SpecificInfo;

            if (specific == null)
            {
                return;
            }

            // Store the camera object into the specific info so that we can retrieve device informations from the configuration dialog.
            specific.Device = device;
            isColor         = DahengHelper.IsColor(featureControl);

            if (firstOpen)
            {
                // Always default to RGB24 for color cameras and Y800 for mono cameras.
                // Raw mode will have to be switched explicitly everytime for now.
                currentStreamFormat = isColor ? DahengStreamFormat.RGB : DahengStreamFormat.Mono;

                // Grab current values.
                Dictionary <string, CameraProperty> cameraProperties = CameraPropertyManager.Read(device);
                specific.CameraProperties = cameraProperties;
                specific.StreamFormat     = currentStreamFormat;
            }
            else
            {
                CameraPropertyManager.WriteCriticalProperties(device, specific.CameraProperties);
                if (specific.StreamFormat != currentStreamFormat)
                {
                    currentStreamFormat = specific.StreamFormat;
                }
            }

            try
            {
                stream = device.OpenStream(0);
            }
            catch
            {
                log.Debug("Could not start Daheng device.");
            }
        }