Skip to content

Commit 82f2418

Browse files
committed
add notes about DLS not connecting>to go to TST
1 parent 72496e9 commit 82f2418

File tree

33 files changed

+429
-246
lines changed

33 files changed

+429
-246
lines changed

1.hello-world/1.hello-world.html

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,24 @@
4646
* "duplicateForgetTime" in "ScanSettings". By default it is set to 3000 ms.
4747
*/
4848
scanner.onUniqueRead = (txt, result) => {
49-
alert(txt);
50-
console.log("Unique Code Found: ", result);
51-
}
52-
/**
53-
* show() opens the camera and shows the video stream on the page.
54-
* After that, the library starts to scan the frame images continuously.
55-
*/
49+
alert(txt);
50+
console.log("Unique Code Found: ", result);
51+
}
52+
/**
53+
* show() opens the camera and shows the video stream on the page.
54+
* After that, the library starts to scan the frame images continuously.
55+
*/
5656
await scanner.show();
5757
} catch (ex) {
58-
alert(ex);
58+
if (ex.message.indexOf("network connection error")) {
59+
let customMsg = "Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
60+
console.log(customMsg);
61+
alert(customMsg);
62+
}
5963
throw ex;
6064
}
6165
})();
6266
</script>
6367
</body>
6468

65-
</html>
69+
</html>

1.hello-world/10.read-video-pwa/helloworld-pwa.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ <h1 style="font-size: 1.5em;">Hello World for PWA</h1>
6464
}
6565
await scanner.show();
6666
} catch (ex) {
67-
alert(ex.message);
67+
if (ex.message.indexOf("network connection error")) {
68+
let customMsg = "Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
69+
console.log(customMsg);
70+
alert(customMsg);
71+
}
6872
throw ex;
6973
}
7074
})();

1.hello-world/11.read-video-requirejs.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ <h1 style="font-size: 1.5em;">Hello World for RequireJS</h1>
4747
}
4848
await scanner.show();
4949
} catch (ex) {
50-
alert(ex.message);
50+
if (ex.message.indexOf("network connection error")) {
51+
let customMsg = "Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
52+
console.log(customMsg);
53+
alert(customMsg);
54+
}
5155
throw ex;
5256
}
5357
})();

1.hello-world/12.read-video-es6.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ <h1 style="font-size: 1.5em;">Hello World for ES6</h1>
5454
}
5555
await scanner.show();
5656
} catch (ex) {
57-
alert(ex.message);
57+
if (ex.message.indexOf("network connection error")) {
58+
let customMsg = "Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
59+
console.log(customMsg);
60+
alert(customMsg);
61+
}
5862
throw ex;
5963
}
6064
})();

1.hello-world/2.read-an-image.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
5656
} catch (ex) {
5757
document.getElementById('p-loading').innerText = ex;
5858
document.getElementById('ipt-file').disabled = true;
59-
alert(ex);
59+
if (ex.message.indexOf("network connection error")) {
60+
let customMsg = "Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
61+
console.log(customMsg);
62+
alert(customMsg);
63+
}
6064
throw ex;
6165
}
6266
})();
@@ -101,7 +105,11 @@ <h1 style="font-size: 1.5em;">Read Barcode from Images</h1>
101105
divResults.appendChild(document.createElement('hr'));
102106
divResults.scrollTop = divResults.scrollHeight;
103107
} catch (ex) {
104-
alert(ex);
108+
if (ex.message.indexOf("network connection error")) {
109+
let customMsg = "Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
110+
console.log(customMsg);
111+
alert(customMsg);
112+
}
105113
throw ex;
106114
} finally {
107115
pReading.style.display = 'none';

1.hello-world/3.read-video-angular/src/app/barcode-scanner/barcode-scanner.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ export class VideoDecodeComponent implements OnInit {
2222
};
2323
await scanner.open();
2424
} catch (ex) {
25-
alert(ex);
25+
if (ex.message.indexOf("network connection error")) {
26+
let customMsg = "Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
27+
console.log(customMsg);
28+
alert(customMsg);
29+
}
2630
}
2731
}
2832
async ngOnDestroy() {

1.hello-world/3.read-video-angular/src/app/hello-world/hello-world.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ export class HelloWorldComponent implements OnInit {
1515
try {
1616
await BarcodeScanner.loadWasm();
1717
} catch (ex) {
18-
alert(ex.message);
18+
if (ex.message.indexOf("network connection error")) {
19+
let customMsg = "Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
20+
console.log(customMsg);
21+
alert(customMsg);
22+
}
23+
throw ex;
1924
}
2025
}
2126
showScanner(): void {

1.hello-world/3.read-video-angular/src/app/img-decode/img-decode.component.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, OnInit } from '@angular/core';
2-
import {BarcodeReader} from 'dynamsoft-javascript-barcode'
2+
import { BarcodeReader } from 'dynamsoft-javascript-barcode'
33

44
@Component({
55
selector: 'app-img-decode',
@@ -9,7 +9,7 @@ import {BarcodeReader} from 'dynamsoft-javascript-barcode'
99
export class ImgDecodeComponent implements OnInit {
1010
pReader = null;
1111

12-
async ngOnInit(): Promise<void> {}
12+
async ngOnInit(): Promise<void> { }
1313

1414
decodeImg = async (e: any) => {
1515
try {
@@ -18,9 +18,14 @@ export class ImgDecodeComponent implements OnInit {
1818
for (const result of results) {
1919
alert(result.barcodeText);
2020
}
21-
if(!results.length){ alert('No barcode found'); }
21+
if (!results.length) { alert('No barcode found'); }
2222
} catch (ex) {
23-
alert(ex);
23+
if (ex.message.indexOf("network connection error")) {
24+
let customMsg = "Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
25+
console.log(customMsg);
26+
alert(customMsg);
27+
}
28+
throw ex;
2429
}
2530
e.target.value = '';
2631
}

1.hello-world/4.read-video-react/src/components/HelloWorld/HelloWorld.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ class HelloWorld extends React.Component {
1818
try {
1919
await BarcodeReader.loadWasm();
2020
} catch (ex) {
21-
alert(ex);
21+
if (ex.message.indexOf("network connection error")) {
22+
let customMsg = "Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
23+
console.log(customMsg);
24+
alert(customMsg);
25+
}
2226
throw ex;
2327
}
2428
}
@@ -36,14 +40,14 @@ class HelloWorld extends React.Component {
3640
bShowImgDecode: true
3741
});
3842
}
39-
43+
4044
render() {
4145
return (
4246
<div className="helloWorld">
4347
<h1>Hello World for React<img src={reactLogo} className="App-logo" alt="logo" /></h1>
4448
<div className="btn-group">
45-
<button style={{marginRight: '10px', backgroundColor: this.state.bShowScanner ? 'rgb(255,174,55)' : 'white'}} onClick={this.showScanner}>Video Decode</button>
46-
<button style={{backgroundColor: this.state.bShowImgDecode ? 'rgb(255,174,55)' : 'white'}} onClick={this.showImgDecode}>Image Decode</button>
49+
<button style={{ marginRight: '10px', backgroundColor: this.state.bShowScanner ? 'rgb(255,174,55)' : 'white' }} onClick={this.showScanner}>Video Decode</button>
50+
<button style={{ backgroundColor: this.state.bShowImgDecode ? 'rgb(255,174,55)' : 'white' }} onClick={this.showImgDecode}>Image Decode</button>
4751
</div>
4852
<div className="container">
4953
{this.state.bShowScanner ? (<VideoDecode></VideoDecode>) : ""}

1.hello-world/4.read-video-react/src/components/ImgDecode/ImgDecode.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ export default class ImgDecode extends Component {
1212
try {
1313
const reader = await (this.pReader = this.pReader || BarcodeReader.createInstance());
1414
let results = await reader.decode(e.target.files[0]);
15-
for(let result of results){
15+
for (let result of results) {
1616
alert(result.barcodeText);
1717
}
18-
if(!results.length){ alert('No barcode found'); }
19-
} catch(ex) {
20-
alert(ex);
18+
if (!results.length) { alert('No barcode found'); }
19+
} catch (ex) {
20+
if (ex.message.indexOf("network connection error")) {
21+
let customMsg = "Failed to connect to Dynamsoft License Server: network connection error. Check your Internet connection or contact Dynamsoft Support (support@dynamsoft.com) to acquire an offline license.";
22+
console.log(customMsg);
23+
alert(customMsg);
24+
}
25+
throw ex;
2126
}
2227
e.target.value = '';
2328
}
@@ -31,7 +36,7 @@ export default class ImgDecode extends Component {
3136

3237
render() {
3338
return (
34-
<div className="ImgDecode"><input type="file" onChange={this.decodeImg}/></div>
39+
<div className="ImgDecode"><input type="file" onChange={this.decodeImg} /></div>
3540
)
3641
}
3742
}

0 commit comments

Comments
 (0)