public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return(null); } LicensePlateItemSource licensePlate = (LicensePlateItemSource)value; return(licensePlate.SecondNumber + " " + licensePlate.Alphabet + " " + licensePlate.FirstNumber); }
public bool ConvertToPlateNumber(LicensePlateItemSource licensePlateItemSource, out string plateNumber) { if (licensePlateItemSource == null) { throw new ArgumentNullException(nameof(licensePlateItemSource)); } if (licensePlateItemSource.FirstNumber?.Length != 2 || string.IsNullOrEmpty(licensePlateItemSource.Alphabet) || licensePlateItemSource.SecondNumber?.Length != 3 || licensePlateItemSource.ProvinceNumber?.Length != 2) { _dialogService.DisplayAlertAsync(ConstantStrings.Error, ConstantStrings.NumberPlateIsNotValid, ConstantStrings.Ok); plateNumber = string.Empty; return(false); } plateNumber = licensePlateItemSource.FirstNumber + "|" + licensePlateItemSource.Alphabet + "|" + licensePlateItemSource.SecondNumber + "|" + licensePlateItemSource.ProvinceNumber; return(true); }