Ejemplo n.º 1
0
        void MainFormLoad(object sender, EventArgs e)
        {
            try {
                SetCameraControlSourceAndResolution(_config.Camera, _config.Resolution);
            } catch (Exception ex) {
                LogError("Error during camera initialization: " + ex.Message);
                return;
            }

            try {
                _cube.Initialize();
                // Set the status LED to bright blue
                _cube.PostCommand("LO");
                _cube.PostCommand("LB200");
            } catch (Exception ex) {
                LogError("Error during sugarcube initialization: " + ex.Message);
                return;
            }
            string le = "38";

            try {
                le = _cube.CubeParameters["LE"];
            } catch {
                LogInfo("35mm Focal Length Equivalent was NOT found in the Z string, defaulting to 38");
            }
            if (String.IsNullOrWhiteSpace(le))
            {
                LogInfo("35mm Focal Length Equivalent was NOT set in the Z string, defaulting to 38");
            }
            else
            {
                LogInfo("Setting 35mm Focal Length Equivalent to " + le);
                _35mmFocalEquivalent = le;
            }
        }
Ejemplo n.º 2
0
        void BtnGoClick(object sender, EventArgs e)
        {
            if (log.IsInfoEnabled)
            {
                log.Info("perparing to send single command to cube");
            }

            if (!_cube.Initialized)
            {
                if (log.IsDebugEnabled)
                {
                    log.Debug("initializing cube");
                }

                try {
                    if (cbForceCOMPort.Checked == true)
                    {
                        _cube.Initialize(cbCOMPortList.Text);
                    }
                    else
                    {
                        _cube.Initialize();
                    }
                } catch (Exception ex) {
                    if (log.IsErrorEnabled)
                    {
                        log.Error("failed to initialize cube", ex);
                    }

                    LogWriteLn("Unable to initialize cube: " + ex.Message);
                    return;
                }
                // Read the Z string
                ReadZString(_cube.CubeParameters);
            }

            if (log.IsDebugEnabled)
            {
                log.Debug("Sending command " + tbSingleCommand.Text + " to the SugarCube");
            }

            LogWriteLn("Sending command " + tbSingleCommand.Text + " to the SugarCube");
            string res = _cube.PostCommand(tbSingleCommand.Text);

            if (log.IsDebugEnabled)
            {
                log.Debug("cube response was: " + res);
            }

            LogWriteLn("<-- " + res);
        }