public GeneratorBarcodePageViewModel() { SetBarcodeTypeCommand = new Command(barcodeType => BarcodeGenerator.SetBarcodeType((BarcodeType)barcodeType)); GenerateCommand = new Command( () => { try { RefreshPage(BarcodeGenerator.Generate(InputWidth, InputHeight, InputMessage)); IsValid = true; GenerationResultText = $"Success:"; } catch (Exception e) { IsValid = false; GenerationResultText = $"Failure : {e.Message}. \nCheck type is valid or not"; } }); }