This commit is contained in:
Samuele Locatelli
2023-11-07 16:58:53 +01:00
4 changed files with 92 additions and 12 deletions
+3 -3
View File
@@ -1,13 +1,13 @@
<div class="row">
<div class="col-12 text-end">
@*<div class="col-12 text-end">
<div class="form-check form-switch fs-3">
<input class="form-check-input" type="checkbox" @bind="@ShowMS">
<label class="form-check-label">@txtSelMS</label>
</div>
</div>
</div>*@
<div class="col-8">
@if (modoControllo == timeControlMode.testo)
@if (tcMode == "mc")
{
<div class="input-group">
<span class="input-group-text">Tempo</span>
+15 -8
View File
@@ -85,10 +85,10 @@ namespace MP_TAB_SERV.Components
/// </summary>
protected double _tempoMC { get; set; } = 0;
protected timeMode modoTempo
{
get => ShowMS ? timeMode.MS : timeMode.MC;
}
//protected timeMode modoTempo
//{
// get => ShowMS ? timeMode.MS : timeMode.MC;
//}
/// <summary>
/// tempo selezionato in formato Minuti Secondi
@@ -107,6 +107,13 @@ namespace MP_TAB_SERV.Components
[Inject]
protected SharedMemService SMServ { get; set; } = null!;
[Inject]
protected MessageService MsgServ { get; set; } = null!;
protected string tcMode
{
get => MsgServ.UserPrefGet("TcMode");
}
/// <summary>
/// tempo selezionato in formato Minuti Secondi
@@ -193,7 +200,7 @@ namespace MP_TAB_SERV.Components
get
{
string answ = "";
if (modoTempo == timeMode.MC)
if (tcMode == "mc")
{
answ = "min.cent";
}
@@ -209,7 +216,7 @@ namespace MP_TAB_SERV.Components
{
get
{
string answ = modoTempo == timeMode.MC ? $"--> {TempoMS.TotalMinutes:N0}:{TempoMS:ss} (min:sec)" : $"--> {TempoMC:0.000} (min.cent)";
string answ = tcMode == "ms" ? $"--> {TempoMS.TotalMinutes:N0}:{TempoMS:ss} (min:sec)" : $"--> {TempoMC:0.000} (min.cent)";
return answ;
}
}
@@ -218,12 +225,12 @@ namespace MP_TAB_SERV.Components
{
get
{
string answ = modoTempo == timeMode.MC ? $"{TempoMC:0.000}" : $"{TempoMS.TotalMinutes:N0}:{TempoMS:ss}";
string answ = tcMode == "mc" ? $"{TempoMC:0.000}" : $"{TempoMS.TotalMinutes:N0}:{TempoMS:ss}";
return answ;
}
set
{
if (modoTempo == timeMode.MC)
if (tcMode == "mc")
{
double tMC = 1;
double.TryParse(value, out tMC);
+73
View File
@@ -43,6 +43,17 @@
</li>
</ul>
</div>
<div>
<ul class="list-group">
<li class="list-group-item">
<div class="text-center mb-1 fw-bold">Modalità di inserimento del tempo ciclo</div>
<div class="d-flex justify-content-between">
<button class="btn btn-sm @btnMsStyle" @onclick='()=>setTcMode("ms")'>min:sec</button>
<button class="btn btn-sm @btnMcStyle" @onclick='()=>setTcMode("mc")'>min.cent</button>
</div>
</li>
</ul>
</div>
</div>
<div class="card-footer">
<button class="w-100 btn btn-success">
@@ -61,6 +72,63 @@
</div>
@code {
[Inject]
private MessageService MsgServ { get; set; } = null!;
protected async Task setTcMode(string tcMode)
{
await Task.Delay(1);
tcModIns = tcMode;
}
protected string btnMsStyle
{
get
{
string answ = "";
if(tcModIns == "ms")
{
answ = "btn-primary";
}
else
{
answ = "btn-secondary";
}
return answ;
}
}
protected string btnMcStyle
{
get
{
string answ = "";
if(tcModIns == "mc")
{
answ = "btn-primary";
}
else
{
answ = "btn-secondary";
}
return answ;
}
}
protected string _tcModIns { get; set; } = "";
protected string tcModIns
{
get => _tcModIns;
set
{
if(_tcModIns != value)
{
_tcModIns = value;
MsgServ.UserPrefSave("TcMode", value);
}
}
}
public int Height { get; set; } = 0;
public int Width { get; set; } = 0;
public string currIpv4 { get; set; } = "";
@@ -82,6 +150,11 @@
}
protected async override Task OnInitializedAsync()
{
var tcPrefItem = MsgServ.UserPrefGet("TcMode");
if(tcPrefItem != null)
{
tcModIns = tcPrefItem;
}
await Task.Delay(1);
if (string.IsNullOrEmpty(currIpv4))
{
+1 -1
View File
@@ -372,8 +372,8 @@ namespace MP.Data.Services
else
{
currDict.Add(chiave, valore);
UsersPrefDict = currDict;
}
UsersPrefDict = currDict;
return done;
}