Exemplo n.º 1
0
        public void HandleScanResult(ZXing.Result result)
        {
            if (!string.IsNullOrEmpty(result?.Text))
            {
                if (TableNrValueText == null)
                {
                    return;
                }
                if (int.TryParse(result.Text, out var number) && number > 0)
                {
                    ThreadPool.QueueUserWorkItem(_ =>
                    {
#if __ANDROID__
                        Thread.Sleep(1000);
#endif
                        TableNrValueText.Visibility = ViewState.Visible;

                        TableNrValueText.Text = result.Text;

                        ConfirmTableText?.SetBackgroundColor(ColorConstants.SelectorHome);
                        ConfirmTableText?.SetSelectedColor(ColorConstants.SelectorHome.SelectorTransparence(ColorConstants.Procent50));
                        ConfirmTableText?.SetTextColor(ColorConstants.WhiteColor);

                        ImageQR?.SetImageFromResource(DrawableConstants.QRIcon);

                        if (ImageScan != null)
                        {
                            ImageScan.Visibility = ViewState.Invisible;
                        }
                    });
                }
                else
                {
                    ShowError(RCode.ReadAgain);
                }
            }
            //else
            //ShowError(RCode.Error);
        }
Exemplo n.º 2
0
        public override void UpdateData()
        {
            base.UpdateData();

            BackgroundContainer?.SetBackgroundColor(ColorConstants.BackroundContent);

            View1?.SetBackgroundColor(ColorConstants.SelectorHome);
            View2?.SetBackgroundColor(ColorConstants.SelectorHome);
            View3?.SetBackgroundColor(ColorConstants.SelectorHome);
            View4?.SetBackgroundColor(ColorConstants.SelectorHome);
            View5?.SetBackgroundColor(ColorConstants.SelectorHome);
            View6?.SetBackgroundColor(ColorConstants.SelectorHome);
            View7?.SetBackgroundColor(ColorConstants.SelectorHome);
            View8?.SetBackgroundColor(ColorConstants.SelectorHome);

            ImageQR?.SetImageFromResource(DrawableConstants.QRBlurryIcon);

            if (ImageScan != null)
            {
                ImageScan.Visibility = ViewState.Visible;
                ImageScan?.SetImageFromResource(DrawableConstants.QRWaitIcon);
            }

            if (ConfirmTableText != null)
            {
                ConfirmTableText.Click -= ConfirmTableText_Click;
                ConfirmTableText.Click += ConfirmTableText_Click;

                ConfirmTableText.Text = RCode.ConfirmTable.ToUpperInvariant();
                ConfirmTableText.SetBackgroundColor(ColorConstants.BlackColor);
                ConfirmTableText.SetSelectedColor(ColorConstants.WhiteColor.SelectorTransparence(ColorConstants.Procent50));
                ConfirmTableText.SetTextColor(ColorConstants.WhiteColor);
                ConfirmTableText.SetFont(FontsConstant.OpenSansBold, FontsConstant.Size14);
            }

            if (TitleText != null)
            {
                TitleText.Text = RCode.QrCode;
                TitleText.SetTextColor(ColorConstants.WhiteColor);
                TitleText.SetFont(FontsConstant.OpenSansBold, FontsConstant.Size18);
            }

            if (TableNrText != null)
            {
                TableNrText.Text = RCode.TableNo;
                TableNrText.SetTextColor(ColorConstants.WhiteColor);
                TableNrText.SetFont(FontsConstant.OpenSansBold, FontsConstant.Size18);
            }

            if (TableNrValueText != null)
            {
                TableNrValueText.Visibility = ViewState.Invisible;

                TableNrValueText.Text = string.Empty;
                TableNrValueText.SetTextColor(ColorConstants.SelectorHome);
                TableNrValueText.SetFont(FontsConstant.OpenSansBold, FontsConstant.Size36);
            }

            if (ImageQR.IsNull())
            {
                return;
            }
            ImageQR.Click -= ImageQR_Click;
            ImageQR.Click += ImageQR_Click;
        }