using AppData; using NKC_SDK; using NKC_WF.Controllers; using SteamWare; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace NKC_WF.WebUserControls { public partial class cmp_secScreen : BaseUserControl { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { showMode = true; // recupero numero currNum = ComLib.getSecScreenCode(); doUpdate(); pdfPath = "../temp/119752.pdf"; } } public int currNum { get { int answ = 0; int.TryParse(hfNum.Value, out answ); return answ; } set { hfNum.Value = $"{value:000000}"; } } public bool showMode { get { bool answ = false; bool.TryParse(hfShowMode.Value, out answ); return answ; } set { hfShowMode.Value = value.ToString(); } } public string pdfPath { get { return lblPdf.Text; } set { // FIXME TODO necessario copiare in locale il pdf? lblPdf.Text = value.Trim(); hlPdfOpener.NavigateUrl = value.Trim(); } } protected string codSSC { get { return $"SSC{currNum:000000}"; } } /// /// restituisce URL immagine QRCode /// /// public string getImageUrl() { string baseUrl = "https://qrcode.steamware.net/HOME/QR_site/JSON?val="; string payload = "{'baseUrl':'{0}','parameters':['" + codSSC + "']}"; string answ = $"{baseUrl}{payload}"; return answ; } /// /// Aggiorna componente principale e child components /// public void doUpdate() { // genero nuovo QR string qrUrl = getImageUrl(); divImg.Visible = showMode; canvasPdf.Visible = !showMode; imgQrSmall.Visible = !showMode; // fix img! if (showMode) { imgQrMain.ImageUrl = qrUrl; } else { imgQrSmall.ImageUrl = qrUrl; } } protected void lbtScambia_Click(object sender, EventArgs e) { pdfPath = ComLib.getSecScreenRequest(codSSC); showMode = !showMode; doUpdate(); // valutato ma non usato pdf.js: // https://mozilla.github.io/pdf.js/examples/index.html#interactive-examples } } }