/// <summary> /// Updates current symbology filter selection to scan according to the selection in the combobox /// </summary> /// <returns></returns> private BarcodeTypeSelector GetBarcodeTypeToFindFromCombobox() { string selectedItemText = cbBarCodeType.Text; if (string.IsNullOrEmpty(selectedItemText)) { throw new Exception("empty barcode type selection!"); } // iterate through properties of barcode selector // and enable the selected property // reset all barcodes selections m_barcodeTypeToScan.Reset(); // iterate through m_barcodeTypeToScan bool properties // checking if we should check this barcode type value foreach (System.Reflection.PropertyInfo propinfo in m_barcodeTypeToScan.GetType().GetProperties()) { // continue if can not write to propery if (!propinfo.CanWrite) { continue; } string name = propinfo.Name; if (name == selectedItemText) { propinfo.SetValue(m_barcodeTypeToScan, true, null); } } return(m_barcodeTypeToScan); }
// Updates barcode type filter according with combobox selection private void UpdateBarcodeTypeToFindFromCombobox() { string selectedItemText = cbBarCodeType.Text; if (string.IsNullOrEmpty(selectedItemText)) { throw new Exception("Empty barcode type selection."); } _barcodeTypeToFind.Reset(); // Iterate through BarcodeTypeSelector bool properties // and enable property by barcode name selected in the combobox foreach (PropertyInfo propertyInfo in typeof(BarcodeTypeSelector).GetProperties()) { // Skip readonly properties if (!propertyInfo.CanWrite) { continue; } if (propertyInfo.Name == selectedItemText) { propertyInfo.SetValue(_barcodeTypeToFind, true, null); } } }