예제 #1
0
        public GeneratorQRCodePageViewModel()
        {
            SetQrModeTypeCommand = new Command(qrModeType =>
                                               QRCodeGenerator.SetQrModeType((QrModeType)qrModeType));
            SetErrorCorrectionLevelCommand = new Command(eccLevel =>
                                                         QRCodeGenerator.SetErrorCorrectionLevel((ErrorCorrectionLevel)eccLevel));
            SetVersionCommand = new Command(version =>
                                            QRCodeGenerator.SetVersion((int)version));

            GenerateCommand = new Command(
                () =>
            {
                try
                {
                    RefreshPage(QRCodeGenerator.Generate(inputWidth, inputHeight, inputMessage));
                    IsValid = true;
                    GenerationResultText = $"Success:";
                }
                catch (Exception e)
                {
                    IsValid = false;
                    GenerationResultText = $"Failure : {e.Message}. \nCheck QrMdoe, ECC, Version are valid or not ";
                }
            });
        }