Redth / ZXing.Net.Mobile

Barcode Scanner for Xamarin.iOS, Xamarin.Android, UWP and Tizen
MIT License
1.07k stars 703 forks source link

UWP AutoRotate not being respected #450

Closed ckrempp91 closed 4 years ago

ckrempp91 commented 8 years ago

In our app we explicitly set the AutoRotate to false to force the orientation to be locked on the current orientation, which works correctly in Android and iOS, but on UWP it still performs the rotation. Here is our code that we use for the scanner:

var scanner = new MobileBarcodeScanner()
{
      UseCustomOverlay = false,
      BottomText = "Hold your camera about \n3 to 6 inches away from the barcode",
};

var result = await scanner.Scan(new MobileBarcodeScanningOptions
{
      AutoRotate = false,
});
return result != null ? result.Text : string.Empty;

We are using Xamarin.Forms 2.3.2.127

I am guessing that this issue occurs because on the ZXingScannerControl, for UWP, the control goes without a check of the AutoRotate property.

bkaankose commented 7 years ago

Approve this.

Will send a PR regarding this issue in a few days.

dpakpaul commented 7 years ago

I'm running into this using 2.2.9 in a UWP app targeting the Anniversary Update SDK in case that matters. Settting AutoRotate = false doesn't lock the orientation to scan a vertical barcode. I can still scan by setting TryHarder and TryInverted to true but it would be ideal to lock the orientation. Since the issue is still open , I assume no PR was submitted. @bkaankose - were you still planning to do this ? Thank you.

Redth commented 4 years ago

Thanks for reporting this issue! Unforunately it took me way too long to respond 😭. Sorry, I apologize! Recently the source code for this project was completely refactored to modernize it. Many PR's were included in this effort, and many bugs were hopefully fixed. Please try out the latest 3.x series of NuGet packages (currently in prerelease). To try and make the project more maintainable in my spare time going forward, I've decided to close all existing issues to start with a clean slate. If you're still experiencing this issue on the newest version, please open a new issue with as much detail as possible. Thank you for your patience and understanding! Happy scanning!