This commit is contained in:
Samuele Locatelli
2023-10-31 10:32:36 +01:00
4 changed files with 45 additions and 31 deletions
+5 -22
View File
@@ -16,7 +16,6 @@ namespace MP_TAB_SERV.Components
[Parameter]
public bool FullMode { get; set; } = true;
public int Height { get; set; } = 0;
[Parameter]
public int keepAliveMin { get; set; } = 5;
@@ -27,8 +26,12 @@ namespace MP_TAB_SERV.Components
[Parameter]
public bool showCard { get; set; }
[Parameter]
public int Width { get; set; } = 0;
[Parameter]
public int Height { get; set; } = 0;
#endregion Public Properties
#region Public Methods
@@ -98,20 +101,6 @@ namespace MP_TAB_SERV.Components
#endregion Public Methods
#region Public Classes
public class WindowDimension
{
#region Public Properties
public int Height { get; set; }
public int Width { get; set; }
#endregion Public Properties
}
#endregion Public Classes
#region Protected Fields
protected string baseCss = "sem";
@@ -161,18 +150,12 @@ namespace MP_TAB_SERV.Components
#region Protected Methods
protected async Task getWDim()
{
var dimension = await JSRuntime.InvokeAsync<WindowDimension>("getWindowDimensions");
Height = dimension.Height;
Width = dimension.Width;
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{//await Task.Delay(500);
if (firstRender)
{
await getWDim();
//await getWDim();
StateHasChanged();
}
isLoading = RecMSE == null;
+2 -2
View File
@@ -137,10 +137,10 @@ else
</div>*@
}
<div class="row textCondens mt-2">
<div class="col-6 py-1 text-start text-uppercase">
<div class="col-4 py-1 text-start text-uppercase">
<b>Dati Globali ODL</b>
</div>
<div class="col-6 d-flex justify-content-end">
<div class="col-8 d-flex justify-content-end pe-3">
<div>
<a class="btn btn-info btn-sm w-100 py-2 px-4" style="min-width: 72px; min-height: 39px" href="scrap"><i class="fa fa-bug"></i></a>
@*<button class="btn btn-sm btn-primary py-2 px-4">MAG</button>*@
+11 -7
View File
@@ -15,17 +15,21 @@
}
else
{
<div class="d-flex justify-content-center">
<label class="form-check-label me-2" for="">Nascondi dettagli</label>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault" @bind="ShowCard">
<label class="form-check-label" for="flexSwitchCheckDefault">Mostra dettagli</label>
@if (Width < 640)
{
<div class="d-flex justify-content-center">
<label class="form-check-label me-2" for="">Nascondi dettagli</label>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault" @bind="ShowCard">
<label class="form-check-label" for="flexSwitchCheckDefault">Mostra dettagli</label>
</div>
</div>
</div>
}
@foreach (var item in ListMSE)
{
<div class="col-6 col-sm-6 col-md-4 col-lg-4 col-xl-3 mb-2 px-1 bloccoMacc">
<MachineBlock RecMSE="@item" FullMode="true" showCard="@ShowCard"></MachineBlock>
<MachineBlock RecMSE="@item" FullMode="true" Width="@Width" Height="@Height" showCard="@ShowCard"></MachineBlock>
</div>
}
}
+27
View File
@@ -1,8 +1,10 @@
using global::Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.Data.Conf;
using MP.Data.DatabaseModels;
using MP.Data.Services;
using NLog;
using System.Runtime.ExceptionServices;
namespace MP_TAB_SERV.Pages
{
@@ -28,6 +30,8 @@ namespace MP_TAB_SERV.Pages
[Inject]
protected MessageService MServ { get; set; } = null!;
[Inject]
protected IJSRuntime JSRuntime{ get; set; } = null!;
protected bool ShowCard
{
@@ -86,6 +90,10 @@ namespace MP_TAB_SERV.Pages
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await getWDim();
}
if (ListMSE != null)
{
// salvo in LocalStorage...
@@ -134,5 +142,24 @@ namespace MP_TAB_SERV.Pages
}
#endregion Private Methods
protected int Width { get; set; } = 0;
protected int Height { get; set; } = 0;
public class WindowDimension
{
#region Public Properties
public int Height { get; set; }
public int Width { get; set; }
#endregion Public Properties
}
protected async Task getWDim()
{
var dimension = await JSRuntime.InvokeAsync<WindowDimension>("getWindowDimensions");
Height = dimension.Height;
Width = dimension.Width;
}
}
}