Update libreria scanner x test
This commit is contained in:
@@ -1,42 +1,69 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_QRScanner.ascx.cs" Inherits="MoonProTablet.WebUserControls.mod_QRScanner" %>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h3 class="text-center"QR-Scan USER LOGIN</h3>
|
||||
</div>
|
||||
<div class="col-12 text-center">
|
||||
<asp:UpdatePanel runat="server" ID="upnDecode">
|
||||
<ContentTemplate>
|
||||
<asp:LinkButton runat="server" ID="lbtGo" CssClass="btn btn-success btn-sm" OnClick="lbtGo_Click"><i class="fa fa-arrow-circle-right"></i> GO</asp:LinkButton>
|
||||
<asp:TextBox runat="server" ID="txtQRCode" Width="25em" AutoPostBack="true" OnTextChanged="txtQRCode_TextChanged" />
|
||||
<asp:HyperLink runat="server" ID="hlReload" NavigateUrl="~/" CssClass="btn btn-success btn-sm"><i class="fa fa-arrow-circle-right"></i> GO</asp:HyperLink>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<video id="preview"></video>
|
||||
<script type="text/javascript">
|
||||
let scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
|
||||
scanner.addListener('scan', function (content) {
|
||||
var isUrl = content.includes("http");
|
||||
if (isUrl) {
|
||||
// se content è un URL --> faccio reload...
|
||||
document.getElementById('<%= hlReload.ClientID %>').href = content;
|
||||
document.getElementById('<%= hlReload.ClientID %>').click();
|
||||
}
|
||||
else {
|
||||
// altrimenti salvo in textBox e processo
|
||||
document.getElementById('<%= txtQRCode.ClientID %>').value = content;
|
||||
document.getElementById('<%= lbtGo.ClientID %>').click();
|
||||
}
|
||||
});
|
||||
Instascan.Camera.getCameras().then(function (cameras) {
|
||||
if (cameras.length > 0) {
|
||||
scanner.start(cameras[0]);
|
||||
} else {
|
||||
console.error('No cameras found.');
|
||||
}
|
||||
}).catch(function (e) {
|
||||
console.error(e);
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<h3 class="text-center">QR-Scan USER LOGIN</h3>
|
||||
</div>
|
||||
<div class="col-12 text-center">
|
||||
<asp:UpdatePanel runat="server" ID="upnDecode">
|
||||
<ContentTemplate>
|
||||
<asp:LinkButton runat="server" ID="lbtGo" CssClass="btn btn-success btn-sm" OnClick="lbtGo_Click"><i class="fa fa-arrow-circle-right"></i> GO</asp:LinkButton>
|
||||
<asp:TextBox runat="server" ID="txtQRCode" Width="25em" AutoPostBack="true" OnTextChanged="txtQRCode_TextChanged" />
|
||||
<asp:HyperLink runat="server" ID="hlReload" NavigateUrl="~/" CssClass="btn btn-success btn-sm"><i class="fa fa-arrow-circle-right"></i> GO</asp:HyperLink>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
<div class="col-12 text-center">
|
||||
<video id="preview"></video>
|
||||
<script type="text/javascript">
|
||||
let scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
|
||||
scanner.addListener('scan', function (content) {
|
||||
var isUrl = content.includes("http");
|
||||
if (isUrl) {
|
||||
// se content è un URL --> faccio reload...
|
||||
document.getElementById('<%= hlReload.ClientID %>').href = content;
|
||||
document.getElementById('<%= hlReload.ClientID %>').click();
|
||||
}
|
||||
else {
|
||||
// altrimenti salvo in textBox e processo
|
||||
document.getElementById('<%= txtQRCode.ClientID %>').value = content;
|
||||
document.getElementById('<%= lbtGo.ClientID %>').click();
|
||||
}
|
||||
});
|
||||
Instascan.Camera.getCameras().then(function (cameras) {
|
||||
if (cameras.length > 0) {
|
||||
scanner.start(cameras[0]);
|
||||
} else {
|
||||
console.error('No cameras found.');
|
||||
}
|
||||
}).catch(function (e) {
|
||||
console.error(e);
|
||||
});
|
||||
<%--function showCamera() {
|
||||
let scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
|
||||
scanner.addListener('scan', function (content) {
|
||||
var isUrl = content.includes("http");
|
||||
if (isUrl) {
|
||||
// se content è un URL --> faccio reload...
|
||||
document.getElementById('<%= hlReload.ClientID %>').href = content;
|
||||
document.getElementById('<%= hlReload.ClientID %>').click();
|
||||
}
|
||||
else {
|
||||
// altrimenti salvo in textBox e processo
|
||||
document.getElementById('<%= txtQRCode.ClientID %>').value = content;
|
||||
document.getElementById('<%= lbtGo.ClientID %>').click();
|
||||
}
|
||||
});
|
||||
Instascan.Camera.getCameras().then(function (cameras) {
|
||||
if (cameras.length > 0) {
|
||||
scanner.start(cameras[0]);
|
||||
} else {
|
||||
console.error('No cameras found.');
|
||||
}
|
||||
}).catch(function (e) {
|
||||
console.error(e);
|
||||
});
|
||||
}--%>
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+27
-25
@@ -1,50 +1,52 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <generato automaticamente>
|
||||
// Codice generato da uno strumento.
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
|
||||
// il codice viene rigenerato.
|
||||
// </generato automaticamente>
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MoonProTablet.WebUserControls {
|
||||
|
||||
|
||||
public partial class mod_QRScanner {
|
||||
|
||||
namespace MoonProTablet.WebUserControls
|
||||
{
|
||||
|
||||
|
||||
public partial class mod_QRScanner
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Controllo upnDecode.
|
||||
/// upnDecode control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.UpdatePanel upnDecode;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Controllo lbtGo.
|
||||
/// lbtGo control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.LinkButton lbtGo;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Controllo txtQRCode.
|
||||
/// txtQRCode control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox txtQRCode;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Controllo hlReload.
|
||||
/// hlReload control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Campo generato automaticamente.
|
||||
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HyperLink hlReload;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user