private void UpdateGainProperty() { CameraPropertyInfo gainPropInfo; try { gainPropInfo = m_camera.GetPropertyInfo(PropertyType.Gain); } catch (FC2Exception ex) { // BasePage.ShowErrorMessageDialog("Error reading gain property", ex); // The message dialog will hang if user unplug camera, so I think we should use debug message instead. Debug.WriteLine("Error reading gain property:" + ex.Message); m_gainTrackbar.Enabled = false; m_gainValue.Enabled = false; return; } m_gainTrackbar.Maximum = (int)gainPropInfo.max; m_gainTrackbar.Minimum = (int)gainPropInfo.min; int gainValue = (int)m_parent.GetGain(m_imageNumber); if (gainValue > m_gainTrackbar.Maximum) { gainValue = m_gainTrackbar.Maximum; } else if (gainValue < m_gainTrackbar.Minimum) { gainValue = m_gainTrackbar.Minimum; } m_gainTrackbar.Value = gainValue; m_gainValue.Text = m_gainTrackbar.Value.ToString(); }
private void UpdateControl() { CameraPropertyInfo camPropInfo; try { camPropInfo = m_camera.GetPropertyInfo(m_propertyType); } catch (FC2Exception ex) { BasePage.ShowErrorMessageDialog("Error getting camera property information.", ex); return; } foreach (LadybugPropertyControlHolder currHolder in m_properties) { currHolder.PropertyValueSpinButton.Minimum = (decimal)camPropInfo.min; currHolder.PropertyValueSpinButton.Maximum = (decimal)camPropInfo.max; currHolder.PropertyValueTrackBar.Minimum = (int)camPropInfo.min; currHolder.PropertyValueTrackBar.Maximum = (int)camPropInfo.max; } UpdatePropertyValues(); }
private bool UpdateControls() { try { m_propInfo = m_camera.GetPropertyInfo(m_propType); if (!m_propInfo.present) { m_isEnabled = false; SetPropertyVisibility(false); return(false); } m_isEnabled = true; SetPropertyVisibility(true); InitializeCheckBoxes(m_propInfo); CameraProperty camProp = m_camera.GetProperty(m_propType); UpdateSpinButtonRange(m_propInfo); if (UpdateSpinButtonValue(camProp)) { // If UpdateSpinButtonValue() returns true, it means the value has been changed UpdateTrackBarValueFromSpinButton(); } UpdateCheckBoxes(camProp); UpdateUnitText(m_propInfo); } catch (FC2Exception ex) { if (ex.Type != ErrorType.PropertyNotPresent) { Debug.WriteLine(DateTime.Now + " - Update for " + m_propType + " failed with: " + ex.CauseType + " (" + ex.Message + ")"); Debug.WriteLine(ex.NativeErrorTrace); } m_isEnabled = false; SetPropertyVisibility(false); ex.Dispose(); return(false); } // This was added to disable controls on a convert to decimal exception. Bug# 26376. catch (ArgumentException ex) { m_isEnabled = false; SetPropertyVisibility(false); return(false); } return(true); }