// Shown here for demonstration purposes only to illustrate the effect of this configuration. public static void SoftwareTrigger(object sender, EventArgs e) { ICamera camera = sender as ICamera; // Get required Enumerations. IEnumParameter triggerSelector = camera.Parameters [PLCamera.TriggerSelector]; IEnumParameter triggerMode = camera.Parameters [PLCamera.TriggerMode]; IEnumParameter triggerSource = camera.Parameters [PLCamera.TriggerSource]; // Check the available camera trigger mode(s) to select the appropriate one: acquisition start trigger mode // (used by older cameras, i.e. for cameras supporting only the legacy image acquisition control mode; // do not confuse with acquisition start command) or frame start trigger mode // (used by newer cameras, i.e. for cameras using the standard image acquisition control mode; // equivalent to the acquisition start trigger mode in the legacy image acquisition control mode). string triggerName = "FrameStart"; if (!triggerSelector.CanSetValue(triggerName)) { triggerName = "AcquisitionStart"; if (!triggerSelector.CanSetValue(triggerName)) { throw new NotSupportedException("Could not select trigger. Neither FrameStart nor AcquisitionStart is available."); } } try { foreach (string trigger in triggerSelector) { triggerSelector.SetValue(trigger); if (triggerName == trigger) { // Activate trigger. triggerMode.SetValue(PLCamera.TriggerMode.On); // Set the trigger source to software. triggerSource.SetValue(PLCamera.TriggerSource.Software); } else { // Turn trigger mode off. triggerMode.SetValue(PLCamera.TriggerMode.Off); } } } finally { // Set selector for software trigger. triggerSelector.SetValue(triggerName); } // Set acquisition mode to Continuous camera.Parameters [PLCamera.AcquisitionMode].SetValue(PLCamera.AcquisitionMode.Continuous); }
// Handles selection changes. private void comboBox_SelectedIndexChanged(object sender, EventArgs e) { if (parameter != null) { try { // If the parameter is readable and the combo box selection is ok ... if (parameter.IsReadable && comboBox.SelectedIndex >= 0) { // ... get the displayed selected enumeration value. EnumValue selectedValue = comboBox.SelectedItem as EnumValue; if (parameter.CanSetValue(selectedValue.ValueName) && selectedValue.ValueName != parameter.GetValue()) { parameter.TrySetValue(selectedValue.ValueName); } } } catch { // Ignore any errors here. } } }