using SteamWare;
using System;
using System.Configuration;

namespace GMW.WebUserControls
{
    public partial class mod_menuBottomFullpage : ApplicationUserControl
    {
        public event EventHandler eh_doRefresh;

        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            // sistemo le stringhe...
            lblApp.Text = string.Format("<b>{0}</b> v.{1}", ConfigurationManager.AppSettings.Get("appName"), System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
            lblCopyRight.Text = string.Format("<b>{0}-{1}</b>", ConfigurationManager.AppSettings.Get("copyRight"), DateTime.Now.Year);
            setTimer();
            setClock();
        }
        /// <summary>
        /// imposta il tempo di scadenza del timer x il refresh della pagina (della parte top) per evitare che la sessione sul server scada
        /// </summary>
        private void setTimer()
        {
            Timer1.Interval = SteamWare.memLayer.ML.confReadInt("intUpdatePagina_ms");
        }
        protected void Timer1_Tick(object sender, EventArgs e)
        {
            setClock();
            // se qualcuno ascolta sollevo evento nuovo valore...
            if (eh_doRefresh != null)
            {
                eh_doRefresh(this, new EventArgs());
            }
        }

        private void setClock()
        {
            lblDateTime.Text = DateTime.Now.ToString("HH:mm:ss");
            lblCodOperatore.Text = GMW_data.MagClass.magazzino.CodSoggCurrUser;
        }
    }
}