private void DisplayResult(Result resultReader) { if (resultReader == null) { return; } result = new ScannerResult(Microsoft.Phone.Tasks.TaskResult.OK); result.ScanCode = resultReader.Text; result.ScanFormat = resultReader.BarcodeFormat.ToString(); FrameworkDispatcher.Update(); scanEffect.Play(); if (this.NavigationService.CanGoBack) { this.NavigationService.GoBack(); } }
/// <summary> /// Callback with the scan result /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void scanner_Completed(object sender, barcodescanner.ScannerResult e) { string result; //FIX var scanner = sender as Scanner; this.OnCommandResult += scanner.OnCommandResult; if (e.TaskResult == TaskResult.OK) { result = String.Format("\"cancelled\":{0}, \"text\":\"{1}\", \"format\":\"{2}\"", false.ToString().ToLower(), e.ScanCode, e.ScanFormat); } else { result = String.Format("\"cancelled\":{0}, \"text\":\"\", \"format\":\"\"", true.ToString().ToLower()); } DispatchCommandResult(new WPCordovaClassLib.Cordova.PluginResult(WPCordovaClassLib.Cordova.PluginResult.Status.OK, "{" + result + "}")); }