コード例 #1
0
        public ReceivePage(BottomTabbedPage tabbedContext)
        {
            InitializeComponent();

            BindingContext =
                ViewModel  =
                    new ReceiveViewModel(this, tabbedContext);

            var qrHeight = (int)(App.ScreenHeight * 0.45);

            Device.BeginInvokeOnMainThread(() =>
            {
                var qrImageView = new ZXingBarcodeImageView
                {
                    BarcodeFormat     = BarcodeFormat.QR_CODE,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    BarcodeOptions    = new EncodingOptions
                    {
                        Width  = qrHeight,
                        Height = qrHeight
                    }
                };

                qrImageView.SetBinding(
                    ZXingBarcodeImageView.BarcodeValueProperty,
                    new Binding(nameof(ViewModel.RequestString)));

                QrWrapper.HeightRequest = qrHeight;
                QrWrapper.Children.Add(qrImageView);
            });
        }
コード例 #2
0
ファイル: SendPage.xaml.cs プロジェクト: NetLS2013/guap
        public SendPage(BottomTabbedPage tabbedContext)
        {
            InitializeComponent();

            BindingContext    =
                SendViewModel =
                    new SendViewModel(this, tabbedContext);
        }
コード例 #3
0
ファイル: ScanPage.xaml.cs プロジェクト: NetLS2013/guap
        public ScanPage(BottomTabbedPage tabbedContext)
        {
            InitializeComponent();

            _tabbedContext = tabbedContext;

            zxing = new ZXingScannerView
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };
            zxing.IsAnalyzing = true;
            zxing.IsScanning  = true;
            zxing.Options.PossibleFormats.Add(BarcodeFormat.QR_CODE);
            zxing.Options.PossibleFormats.Add(BarcodeFormat.DATA_MATRIX);
            zxing.Options.PossibleFormats.Add(BarcodeFormat.EAN_13);
            zxing.AutoFocus();
            zxing.OnScanResult += OnScan;

            overlay = new ZXingDefaultOverlay
            {
                TopText         = "Hold your phone up to the QR code",
                BottomText      = "Scanning will happen automatically",
                ShowFlashButton = zxing.HasTorch,
            };
            overlay.FlashButtonClicked += (sender, e) => {
                zxing.IsTorchOn = !zxing.IsTorchOn;
            };
            var grid = new Grid
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            grid.Children.Add(zxing);
            grid.Children.Add(overlay);

            Content  = grid;
            _message = DependencyService.Get <IMessage>();
        }