private async void StopScan() { if (UseNativeCamera) { await CameraController.StopPreviewAsync(); ScannerController.Stop(); ScannerController.DataReceived -= ScannerController_DataReceived; this.ResetTheScenarioState(); ScannerController.StartWatcher(Dispatcher); } }
public MainPage() { this.InitializeComponent(); HockeyClient.Current.TrackTrace("Starting mainpage on platform: " + AnalyticsInfo.VersionInfo.DeviceFamily); DetectPlatform(); scanner = new MobileBarcodeScanner(this.Dispatcher); scanner.Dispatcher = this.Dispatcher; if (UseNativeCamera) { ScannerController = new ScannerController(); ScannerController.StartWatcher(this.Dispatcher); CameraController = new CameraController(ScannerController); CameraController.OnFixedFocusCameraDetected += CameraController_OnFixedFocusCameraDetected; } var app = App.Current as App; ProductsController = app.ProductsController; ProductsController.PropertyChanged += ProductsController_PropertyChanged; this.DataContext = ProductsController; if (UseNativeCamera) { this.ProductCameraFeedControl.StartPressed += ProductCameraFeedControl_StartPressed; this.ProductCameraFeedControl.StopPressed += ProductCameraFeedControl_StopPressed; this.ProductCameraFeedControl.DataContext = CameraController; } this.ProductSearchControl.DataContext = ProductsController; this.ProductSearchControl.IsEnabledChanged += ProductSearchControl_IsEnabledChanged; this.ProductSearchControl.StartSearch += ProductSearchControl_StartSearch; this.IngredientsCtrl.IngredientDetailRequested += IngredientsCtrl_IngredientDetailRequested; this.ProductDetailsCtrl.IngredientDetailRequested += ProductDetailsCtrl_IngredientDetailRequested;; this.IngredientDetailCtrl.Tapped += IngredientDetailCtrl_Tapped; this.UnknownProductCtrl.OkPressed += UnknownProductCtrl_OkPressed; this.UnknownProductCtrl.CancelPressed += UnknownProductCtrl_CancelPressed; //ResetTheScenarioState(); }