Files
mapo-mono/MP.MONO.UI/Pages/Parameters.razor.cs
T
2022-09-30 12:10:42 +02:00

133 lines
2.9 KiB
C#

using MP.MONO.UI.Data;
namespace MP.MONO.UI.Pages
{
public partial class Parameters
{
#region Private Fields
private int maxRecord = 120;
private bool showParam = false;
private DateTime DateFrom
{
get => SelFilter.DtStart;
set => SelFilter.DtStart = value;
}
private DateTime DateTo
{
get => SelFilter.DtEnd;
set => SelFilter.DtEnd = value;
}
protected DataLogFilter SelFilter { get; set; } = new DataLogFilter();
#endregion Private Fields
#region Protected Fields
protected bool isRT = true;
protected double sampleSecMin = 1;
#endregion Protected Fields
#region Protected Properties
protected string currMode
{
get => isRT ? "RealTime" : "Log View";
}
protected string btnResetCss
{
get => selParams != null && selParams.Count > 0 ? "" : "disabled";
}
protected List<string> selParams { get; set; } = new List<string>();
#endregion Protected Properties
#region Public Properties
public string pcss
{
get
{
string answ = "col-12";
int numPar = selParams.Count;
if (numPar > 6)
{
answ = "col-4";
}
else if (numPar > 3)
{
answ = "col-6";
}
return answ;
}
}
#endregion Public Properties
#region Private Methods
private void toggleParam()
{
showParam = !showParam;
}
#endregion Private Methods
#region Protected Methods
protected void paramAdded(string paramName)
{
if (!selParams.Contains(paramName))
{
selParams.Add(paramName);
}
}
protected string lastParam
{
get
{
string answ = "";
if (selParams.Count > 0)
{
answ = $"{selParams.LastOrDefault()}";
}
return answ;
}
}
protected void paramRemoved(string paramName)
{
if (selParams.Contains(paramName))
{
// controllo se è ultimo rimuovo direttamente
if (paramName == lastParam)
{
selParams.Remove(paramName);
}
}
}
protected void resetSel()
{
selParams = new List<string>();
}
protected void toggleRT()
{
isRT = !isRT;
}
#endregion Protected Methods
private void toggleShowParams()
{
showParam = !showParam;
}
}
}