using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace MP_MAG.WebUserControls { public partial class cmp_barcode : BaseUserControl { #region Public Properties /// /// Valore acquisito in lettura barcode /// public string inputAcquired { get { return txtBarcode.Text.Trim(); } set { txtBarcode.Text = value; txtBarcode.Focus(); } } #endregion Public Properties #region Protected Methods protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { resetMessage(); } else if (string.IsNullOrEmpty(inputAcquired)) { raiseEvent(); } } protected void txtBarcode_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(inputAcquired)) { raiseEvent(); } } #endregion Protected Methods #region Public Methods public void resetMessage() { lblOutput.Visible = false; lblOutput.Text = ""; } /// /// Gestione output da mostrare (opzionale /// /// /// public void showOutput(string cssClass, string messaggio) { // In primis: mostro qualcosa SOLO SE ho del testo lblOutput.Attributes.Remove("class"); lblOutput.Attributes.Add("class", cssClass); lblOutput.Text = messaggio; lblOutput.Visible = !string.IsNullOrEmpty(messaggio); } #endregion Public Methods } }