Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/windows8/BarcodeScannerProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {

var capturePreview = null,
captureCancelButton = null,
captureCanceled = false,
capture = null,
captureSettings = null,
reader = null,
Expand Down Expand Up @@ -74,8 +75,10 @@ module.exports = {
reader = new WinRTBarcodeReader.Reader(capture, bitmapWidth, bitmapHeight);
var readOp = reader.readCode();
readOp.done(function (result) {
destroyPreview();
success({ text: result.text, format: result.barcodeFormat, cancelled: false });
if (!captureCanceled) {
destroyPreview();
success({ text: result.text, format: result.barcodeFormat, cancelled: false });
}
});
}

Expand Down Expand Up @@ -105,6 +108,7 @@ module.exports = {
* See https://github.com/phonegap-build/BarcodeScanner#using-the-plugin
*/
function cancelPreview() {
captureCanceled = true;
destroyPreview();
success({ text: null, format: null, cancelled: true });
}
Expand Down
Binary file modified src/windows8/lib/WinRTBarcodeReader.winmd
Binary file not shown.
14 changes: 8 additions & 6 deletions src/windows8/lib/WinRTBarcodeReader/WinRTBarcodeReader/Reader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,18 @@ public void Stop()
private async Task<Result> Read()
{
Result result = null;
while (!this.barcodeFound)
try
{
try
while (!this.barcodeFound)
{

result = await this.GetCameraImage(this.cancelSearch.Token);

}
catch (OperationCanceledException)
{
result = null;
}
}
catch (OperationCanceledException)
{
result = null;
}

return result;
Expand Down