コード例 #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();
        }
コード例 #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();
        }
コード例 #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.");
            }
        }
コード例 #4
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.");
            }
        }