【问题标题】:Does default Zxing.Net.Mobile overlay contain a flash/torch button?默认的 Zxing.Net.Mobile 覆盖是否包含闪光灯/手电筒按钮?
【发布时间】:2017-03-03 15:09:56
【问题描述】:

我在我的 Windows 10 通用应用程序中使用 Zxing.Net.Mobile 包。我使用默认叠加层,这在我看来非常好。现在我想在我的应用程序中添加 Flash/Torch 功能。我只发现解决方案定义了一个新的自定义覆盖。不能在默认叠加层中激活 Torch 按钮吗?我找到了一个scanner.FlashButtonText 定义,所以我认为一个flashbutton 应该以某种方式是可激活的,我只是不知道这个参数的名称。有人可以帮我弄这个吗?谢谢。

我的代码如下所示:

            var options = new MobileBarcodeScanningOptions
            {
                AutoRotate = false,
                TryHarder = true,
                PossibleFormats = new List<ZXing.BarcodeFormat>
                {
                    ZXing.BarcodeFormat.EAN_8, ZXing.BarcodeFormat.EAN_13, ZXing.BarcodeFormat.UPC_A, ZXing.BarcodeFormat.UPC_E
                }
            };


            var scanner = new MobileBarcodeScanner(this.Dispatcher);

            scanner.UseCustomOverlay = false;
            scanner.RootFrame = MyFrame;
            scanner.TopText = "Halte die Kamera vor den Barcode";
            scanner.BottomText = "Die Kamera scannt den Barcode automatisch";
            scanner.FlashButtonText = "activate Torch";


            var result = await scanner.Scan(options);

【问题讨论】:

    标签: win-universal-app zxing torch flashlight


    【解决方案1】:

    虽然MobileBarcodeScanner有一个FlashButtonText属性,但是根据ZXing.Net.Mobile's source code的说法,目前默认叠加层不支持Flash/Torch功能。

    默认叠加层由ZXingScannerControl 设置,如果我们查看它的源代码,我们会发现它确实有一个名为“buttonToggleFlash”的按钮。但是这个按钮是不可见的,没有属性可以控制它的可见性。

    source code:

    <Border Grid.Row="0" Visibility="Collapsed" VerticalAlignment="Top" HorizontalAlignment="Right" Width="120" Height="80">
        <Button x:Name="buttonToggleFlash" Click="buttonToggleFlash_Click">Flash</Button>
    </Border> 
    

    所以要支持 Flash/Torch 功能,您需要自定义叠加层。或者您可以编辑源代码并根据您的目的重新构建 ZXing.Net.Mobile。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多