コード例 #1
0
        /// <summary>
        /// Deattach events
        /// </summary>
        private void closeScanner()
        {
            // Unhook from events
            if (null != _frame)
            {
                _frame.Navigated         -= OnFrameNavigated;
                _frame.NavigationStopped -= OnFrameNavigationStoppedOrFailed;
                _frame.NavigationFailed  -= OnFrameNavigationStoppedOrFailed;

                _frame = null;
                _frameContentWhenOpened = null;
            }

            if (null != _scannerPage)
            {
                _scannerPage = null;
            }
        }
コード例 #2
0
 private void OnFrameNavigated(object sender, NavigationEventArgs e)
 {
     if (e.Content == _frameContentWhenOpened)
     {
         // Navigation to original page; close the scanner page
         closeScanner();
     }
     else if (null == _scannerPage)
     {
         _scannerPage = e.Content as barcodescanner.Scanner;
         if (null != _scannerPage)
         {
             //FIX
             _scannerPage.OnCommandResult = this.ResultHandlers.First().Value;
             _scannerPage.Completed      += new EventHandler <barcodescanner.ScannerResult>(scanner_Completed);
         }
     }
 }