Example #1
0
        protected override void OnNavigatingFrom(System.Windows.Navigation.NavigatingCancelEventArgs e)
        {
            //we're navigating away from this page, we won't be scanning any barcodes
            _scanTimer.Stop();

            if (_phoneCamera != null)
            {
                // Cleanup
                _phoneCamera.Dispose();
                _phoneCamera.Initialized            -= Camera_Initialized;
                CameraButtons.ShutterKeyHalfPressed -= CameraButtons_ShutterKeyHalfPressed;
            }

            if (_scanConfirmation.IsOpen)
            {
                _scanConfirmation.IsOpen = false;
            }

            if (OpticalReaderTask.TaskPending)
            {
                if (e.NavigationMode == NavigationMode.Back)
                {
                    OpticalReaderTask.CancelTask(true);
                }
                else
                {
                    OpticalReaderTask.CancelTask(false);
                }
            }
        }
Example #2
0
        void ok_ConfirmationClick(object sender, RoutedEventArgs e)
        {
            OpticalReaderTask.CompleteTask(_processResult, null);
            OpticalReaderTask.TaskPending = false;

            _scanConfirmation.IsOpen = false;

            NavigationService.GoBack();
        }
Example #3
0
 public OpticalReaderTask()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     else
     {
         throw new Exception("Only one instance of OpticalReaderTask is supported at a time and another instance already exists.");
     }
 }
Example #4
0
 public void Dispose()
 {
     _instance = null;
 }