示例#1
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            SystemTray.ProgressIndicator.IsVisible = true;

            App.Camera.Focused       += Camera_Focused;
            App.Camera.PhotoCaptured += Camera_PhotoCaptured;

            ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = false;

            await App.Camera.InitializeAsync();

            CameraBrush.SetSource(App.Camera.Device);

            ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = true;
            SystemTray.ProgressIndicator.IsVisible = false;
        }
示例#2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            BackKeyPress           += BarcodeScannerUI_BackKeyPress;
            cancellationTokenSource = new CancellationTokenSource();

            // Instantiate objects and start camera preview
            this.camera = new PhotoCamera();
            this.reader = new BarcodeReader {
                Options = { TryHarder = true }
            };

            CameraBrush.SetSource(this.camera);

            // Bind events
            this.camera.Initialized += CameraInitialized;
            this.reader.ResultFound += ReaderResultFound;

            base.OnNavigatedTo(e);
        }