Exemplo n.º 1
0
        protected override void OnResume()
        {
            base.OnResume();
            if (PermissionsHandler.NeedsPermissionRequest(this))
            {
                PermissionsHandler.RequestPermissionsAsync(this);
            }
            _scanner.StartScanning(result =>
            {
                if (!result.Text.Contains(":"))
                {
                    return;
                }

                RunOnUiThread(() =>
                {
                    try
                    {
                        Toast.MakeText(this, "Request Scanned. Please wait.", ToastLength.Long).Show();
                    }
                    catch (Exception e)
                    {
                        var f = e;
                    }
                });

                QrCodeScanCommand.Execute(result.Text);
            },
                                   MobileBarcodeScanningOptions.Default);
        }
Exemplo n.º 2
0
        protected override void OnResume()
        {
            base.OnResume();

            if (scanFragment == null)
            {
                scanFragment = new CustomScannerFragment
                {
                    BottomText = learningTask.Description
                };
                SupportFragmentManager.BeginTransaction()
                .Replace(Resource.Id.fragment_container, scanFragment)
                .Commit();
            }

            bool needsPermission = PermissionsHandler.NeedsPermissionRequest(this);

            if (needsPermission)
            {
                PermissionsHandler.RequestPermissionsAsync(this);
            }
            else
            {
                scanFragment.StartScanning(OnScanResult, GetOptions());
            }
        }
		public async void SurfaceCreated(ISurfaceHolder holder)
		{
			await PermissionsHandler.RequestPermissionsAsync();

			cameraAnalyzer.SetupCamera();

			surfaceCreated = true;
		}