/// <summary> /// Event handler for Symbology listbox selection changed. /// Get symbology attributes and populate attribute UI components /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private async void SymbologySelection_Changed(object sender, SelectionChangedEventArgs args) { if (claimedScanner != null) { SymbologyListEntry symbologyListEntry = (SymbologyListEntry)SymbologyListBox.SelectedItem; if (symbologyListEntry != null) { SetSymbologyAttributesButton.IsEnabled = false; try { symbologyAttributes = await claimedScanner.GetSymbologyAttributesAsync(symbologyListEntry.Id); } catch (Exception) { symbologyAttributes = null; } if (symbologyAttributes != null) { SetSymbologyAttributesButton.IsEnabled = true; // initialize attributes UIs EnableCheckDigit.IsEnabled = symbologyAttributes.IsCheckDigitValidationSupported; EnableCheckDigit.IsChecked = symbologyAttributes.IsCheckDigitValidationEnabled; TransmitCheckDigit.IsEnabled = symbologyAttributes.IsCheckDigitTransmissionSupported; TransmitCheckDigit.IsChecked = symbologyAttributes.IsCheckDigitTransmissionEnabled; SetDecodeRangeLimits.IsEnabled = symbologyAttributes.IsDecodeLengthSupported; bool decodeLengthEnabled = (symbologyAttributes.DecodeLengthKind == BarcodeSymbologyDecodeLengthKind.Range); SetDecodeRangeLimits.IsChecked = decodeLengthEnabled; if (decodeLengthEnabled) { MinimumDecodeLength.Value = Math.Min(symbologyAttributes.DecodeLength1, symbologyAttributes.DecodeLength2); MaximumDecodeLength.Value = Math.Max(symbologyAttributes.DecodeLength1, symbologyAttributes.DecodeLength2); } } else { rootPage.NotifyUser("Symbology attributes are not available.", NotifyType.ErrorMessage); EnableCheckDigit.IsEnabled = false; TransmitCheckDigit.IsEnabled = false; SetDecodeRangeLimits.IsEnabled = false; } } } }