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); } } }
void ok_ConfirmationClick(object sender, RoutedEventArgs e) { OpticalReaderTask.CompleteTask(_processResult, null); OpticalReaderTask.TaskPending = false; _scanConfirmation.IsOpen = false; NavigationService.GoBack(); }
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."); } }
public void Dispose() { _instance = null; }