private async void Application_Suspending(object sender, SuspendingEventArgs e) { //Debug.WriteLine("Application Suspending"); var deferral = e.SuspendingOperation.GetDeferral(); this.scanningTimer.Dispose(); this.cameraManager.ScanForQRcodes = false; this.qrAnalyzerCancellationTokenSource.Cancel(); await cameraManager.CleanupCameraAsync(); this.barcodeManager = null; this.cameraManager = null; deferral.Complete(); }
//private string lastQrSSid { get; set; } public MainPage() { this.InitializeComponent(); //catchall crash handler AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += new System.UnhandledExceptionEventHandler(CrashHandler); QrCodeDecodedDelegate handler = new QrCodeDecodedDelegate(handleQRcodeFound); qrAnalyzerCancellationTokenSource = new CancellationTokenSource(); cameraManager = new QRCameraManager(PreviewControl, Dispatcher, handler, qrAnalyzerCancellationTokenSource); barcodeManager = new BarcodeManager(); Application.Current.Suspending += Application_Suspending; Application.Current.Resuming += Current_Resuming; Application.Current.LeavingBackground += Current_LeavingBackground; cameraManager.EnumerateCameras(cmbCameraSelect); this.donateLnk.NavigateUri = new Uri("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=C6Q6ETR8PMDUL2&source=url"); this.donateLnkGenerate.NavigateUri = new Uri("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=C6Q6ETR8PMDUL&source=url"); this.donateLnkOpen.NavigateUri = new Uri("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=C6Q6ETR8PMDUL&source=url"); }