private void btnGenerateBarcode_Clicked(object sender, EventArgs e) { if (btnBarcodeOptions.Active) { try { SetGeneratedBarcodeValue(BarcodeGenerator.GenerateCustom((GeneratedBarcodeType)cboBarcodeType.GetSelectedValue(), txtBarcodeFormat.Text)); } catch (InvalidDataException ex) { MessageError.ShowDialog(ex.Message, ErrorSeverity.Error, ex); } } else { try { SetGeneratedBarcodeValue(BarcodeGenerator.Generate(BusinessDomain.AppConfiguration.GeneratedBarcodeType)); } catch (InvalidDataException ex) { MessageError.ShowDialog(Translator.GetString("Barcode cannot be generated with the current settings. All barcode numbers with the specified prefix and type are in use."), ErrorSeverity.Error, ex); } } }