Exemplo n.º 1
0
        public void UpdateStrobeControl()
        {
            StrobeInfo strobeInfo;

            try
            {
                strobeInfo = m_camera.GetStrobeInfo(m_pinNumber);
            }
            catch (FC2Exception ex)
            {
                m_controlGroupBox.Enabled = false;
                Debug.WriteLine(string.Format(
                                    "Error getting strobe information (Pin number: {0}): {1}",
                                    m_pinNumber,
                                    ex.Message));
                return;
            }

            StrobeControl strobeControl;

            try
            {
                strobeControl = m_camera.GetStrobe(m_pinNumber);
            }
            catch (FC2Exception ex)
            {
                m_controlGroupBox.Enabled = false;
                Debug.WriteLine(string.Format(
                                    "Error getting strobe (Pin number: {0}): {1}",
                                    m_pinNumber,
                                    ex.Message));
                return;
            }

            m_enableStrobeCheckbox.Checked = strobeControl.onOff;
            bool isPolarityLow = strobeControl.polarity == 0;

            if (isPolarityLow)
            {
                m_lowPolarityButton.Checked = true;
            }
            else
            {
                m_highPolarityButton.Checked = true;
            }

            m_delaySpinButton.Minimum = (decimal)strobeInfo.minValue;
            m_delaySpinButton.Maximum = (decimal)strobeInfo.maxValue;

            m_durationSpinButton.Minimum = (decimal)strobeInfo.minValue;
            m_durationSpinButton.Maximum = (decimal)strobeInfo.maxValue;

            try
            {
                m_delaySpinButton.Value = (decimal)strobeControl.delay;
            }
            catch (ArgumentOutOfRangeException ex)
            {
                m_delaySpinButton.Value = m_delaySpinButton.Minimum;
                Debug.WriteLine("The range (or current value in camera) of strobe delay property is invalid.");
                Debug.WriteLine(ex.StackTrace);
            }

            try
            {
                m_durationSpinButton.Value = (decimal)strobeControl.duration;
            }
            catch (ArgumentOutOfRangeException ex)
            {
                m_durationSpinButton.Value = m_durationSpinButton.Minimum;
                Debug.WriteLine("The range (or current value in camera) of strobe duration property is invalid.");
                Debug.WriteLine(ex.StackTrace);
            }

            UpdateChildControls();
            SetTooltips();
        }