예제 #1
0
        private SettingsManager()
        {
            this.CurrentCamera?.ApplySettingsAsync(this.CameraSettings);

            // The barcode capturing process is configured through barcode capture settings
            // which are then applied to the barcode capture instance that manages barcode recognition.
            this.BarcodeCaptureSettings = BarcodeCaptureSettings.Create();

            // Create data capture context using your license key and set the camera as the frame source.
            this.DataCaptureContext = DataCaptureContext.ForLicenseKey(SCANDIT_LICENSE_KEY);
            this.DataCaptureContext.SetFrameSourceAsync(this.CurrentCamera);

            // Create new barcode capture mode with the settings from above.
            this.BarcodeCapture         = BarcodeCapture.Create(this.DataCaptureContext, this.BarcodeCaptureSettings);
            this.BarcodeCapture.Enabled = true;

            // Create a new overlay with the barcode capture from above, and retrieve the default brush.
            this.BarcodeCaptureOverlay = BarcodeCaptureOverlay.Create(this.BarcodeCapture, null);

            // Create a temporary RectangularViewfinder instance to get default values for width and height.
            using RectangularViewfinder tempRectangularViewfinder = RectangularViewfinder.Create();
            this.RectangularViewfinderWidth  = tempRectangularViewfinder.SizeWithUnitAndAspect.WidthAndHeight.Width;
            this.RectangularViewfinderHeight = tempRectangularViewfinder.SizeWithUnitAndAspect.WidthAndHeight.Height;

            // Create a temporary SpotlightViewfinder instance to get default values for width and height.
            using SpotlightViewfinder tempSpotlightViewfinder = SpotlightViewfinder.Create();
            this.SpotlightViewfinderWidth  = tempSpotlightViewfinder.SizeWithUnitAndAspect.WidthAndHeight.Width;
            this.SpotlightViewfinderHeight = tempSpotlightViewfinder.SizeWithUnitAndAspect.WidthAndHeight.Height;
        }
예제 #2
0
        public ViewfinderType GetCurrentViewfinderType()
        {
            IViewfinder viewfinder = this.settingsManager.CurrentViewfinder;

            return(viewfinder switch
            {
                RectangularViewfinder _ => ViewfinderTypeRectangular.FromCurrentViewfinderAndSettings(viewfinder, this.settingsManager),
                LaserlineViewfinder _ => ViewfinderTypeLaserline.FromCurrentViewfinderAndSettings(viewfinder, this.settingsManager),
                SpotlightViewfinder _ => ViewfinderTypeSpotlight.FromCurrentViewfinderAndSettings(viewfinder, this.settingsManager),
                _ => ViewfinderTypeNone.FromCurrentViewFinder(viewfinder)
            });