135 lines
3.6 KiB
C#
135 lines
3.6 KiB
C#
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_MachSem : BaseUserControl
|
|
{
|
|
#region Public Properties
|
|
|
|
public string currMachine
|
|
{
|
|
get
|
|
{
|
|
string answ = "";
|
|
answ = memLayer.ML.QSS("mach");
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
if (!string.IsNullOrEmpty(value))
|
|
{
|
|
string url = $"{currPage}?mach={value}";
|
|
Response.Redirect(url);
|
|
}
|
|
}
|
|
}
|
|
|
|
public string currPage
|
|
{
|
|
get
|
|
{
|
|
string url = HttpContext.Current.Request.Url.PathAndQuery;
|
|
if (url.Contains("?mach="))
|
|
{
|
|
url = url.Substring(0, url.IndexOf("?mach="));
|
|
}
|
|
return url;
|
|
}
|
|
}
|
|
|
|
public bool machSelected
|
|
{
|
|
get
|
|
{
|
|
return (!string.IsNullOrEmpty(currMachine));
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Private Methods
|
|
|
|
private void checkVisibility()
|
|
{
|
|
divSelect.Visible = !machSelected;
|
|
divRuntime.Visible = machSelected;
|
|
hfMachClass.Value = currMachine == "NE01" ? "dark" : "light";
|
|
lbtReset.Attributes.Remove("class");
|
|
lbtReset.Attributes.Add("class", $"btn btn-block text-center btn-{hfMachClass.Value}");
|
|
}
|
|
|
|
#endregion Private Methods
|
|
|
|
#region Protected Methods
|
|
|
|
protected void ddlMachine_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
currMachine = ddlMachine.SelectedValue;
|
|
}
|
|
|
|
protected void lbtReset_Click(object sender, EventArgs e)
|
|
{
|
|
Response.Redirect(currPage);
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
hfMachine.Value = currMachine;
|
|
checkVisibility();
|
|
lbtReset.DataBind();
|
|
}
|
|
|
|
protected void timerLoad_Tick(object sender, EventArgs e)
|
|
{
|
|
doUpdate();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Public Methods
|
|
|
|
public void doUpdate()
|
|
{
|
|
// verifico status delle 3 parti e mostro relativo semaforo...
|
|
|
|
// FIXME TODO: fake....
|
|
DateTime adesso = DateTime.Now;
|
|
int numsec = adesso.Second;
|
|
hfCss01.Value = "success";
|
|
hfCss02.Value = "warning";
|
|
hfCss03.Value = "danger";
|
|
hfStat01.Value = $"{adesso.Second - 1 % 10:00}";
|
|
hfStat02.Value = $"{adesso.Second + 3 % 10:00}";
|
|
hfStat03.Value = $"{adesso.Second + 1 % 10:00}";
|
|
switch (numsec % 3)
|
|
{
|
|
case 1:
|
|
hfCss01.Value = "warning";
|
|
hfCss02.Value = "danger";
|
|
hfCss03.Value = "success";
|
|
break;
|
|
|
|
case 2:
|
|
hfCss01.Value = "danger";
|
|
hfCss02.Value = "success";
|
|
hfCss03.Value = "warning";
|
|
break;
|
|
|
|
case 0:
|
|
default:
|
|
hfCss01.Value = "success";
|
|
hfCss02.Value = "warning";
|
|
hfCss03.Value = "danger";
|
|
break;
|
|
}
|
|
}
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |