private void OnNavigated(object sender, NavigationEventArgs e)
        {
            if (!(e.Content is Pdf417ScannerPage))
            {
                return;
            }

            var phoneApplicationFrame = Application.Current.RootVisual as PhoneApplicationFrame;

            if (phoneApplicationFrame != null)
            {
                phoneApplicationFrame.Navigated -= this.OnNavigated;
            }

            var pdf417Scanner = (Pdf417ScannerPage)e.Content;

            if (pdf417Scanner != null)
            {
                pdf417Scanner.OnComplete += pdf417Scanner_OnComplete;
                pdf417Scanner.OnFailure  += pdf417Scanner_OnFailure;
                pdf417Scanner.OnCancel   += pdf417Scanner_OnCancel;
            }
            else
            {
                DispatchCommandResult(Pdf417ScannerResult.CancelResult());
            }
        }
 void pdf417Scanner_OnCancel()
 {
     DispatchCommandResult(Pdf417ScannerResult.CancelResult());
 }