public QRCameraManager(CaptureElement previewWindowElement, CoreDispatcher dispatcher, QrCodeDecodedDelegate qrCodeDecodedDelegate, CancellationTokenSource qrAnalyzerCancellationTokenSource)
 {
     this.previewWindowElement  = previewWindowElement;
     this.dispatcher            = dispatcher;
     this.qrCodeDecodedDelegate = qrCodeDecodedDelegate;
     //var qrAnalyzerCancellationTokenSource = new CancellationTokenSource();
     this.qrAnalyzerCancellationTokenSource = qrAnalyzerCancellationTokenSource;
     this.inMemoryRandomAccessStream        = new InMemoryRandomAccessStream();
     writeableBitmap = new WriteableBitmap(imgCaptureWidth, imgCaptureHeight);
 }
        //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");
        }