Aggiunto test mobile/desktop

This commit is contained in:
Samuele Locatelli
2024-02-21 18:49:39 +01:00
parent 68c66fec24
commit e390874ef6
4 changed files with 37 additions and 22 deletions
+11 -6
View File
@@ -249,10 +249,15 @@ else
@if (showDraw && RecMSE != null)
{
<iframe src="@($"disegni/{RecMSE.CodArticolo}.pdf")" width="100%" height="60%" />
@* <object type="application/pdf" data="@($"disegni/{RecMSE.CodArticolo}.pdf")" width="100%" height="60%" /> *@
@* <embed src="@($"disegni/{RecMSE.CodArticolo}.pdf")" width="100%" height="800px" /> *@
if (isMobile)
{
<h3>Mobile</h3>
<iframe src="@($"disegni/{RecMSE.CodArticolo}.pdf")" width="100%" height="50%" />
}
else
{
<h3>DESKTOP</h3>
<object type="application/pdf" data="@($"disegni/{RecMSE.CodArticolo}.pdf")" width="100%" height="60%" />
}
@* <embed src="@($"disegni/{RecMSE.CodArticolo}.pdf")" width="100%" height="50%" /> *@
}
+22 -16
View File
@@ -5,6 +5,7 @@ using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.Data.Services;
using NLog;
using System;
namespace MP_TAB3.Components
{
@@ -37,16 +38,6 @@ namespace MP_TAB3.Components
#endregion Public Properties
private bool showDraw { get; set; } = false;
/// <summary>
/// Toggle visibilità button
/// </summary>
protected void ToggleDraw()
{
showDraw = !showDraw;
}
#region Public Methods
/// <summary>
@@ -93,15 +84,10 @@ namespace MP_TAB3.Components
#region Protected Fields
protected string baseCss = "sem";
protected int currMaxVal = 1000;
protected List<CircleGaugeMulti.CircSegm> innerCircleVals = new List<CircleGaugeMulti.CircSegm>();
protected int kaFactor = 60 / 2;
protected int maxVal = 1000;
protected List<CircleGaugeMulti.CircSegm> outerCircleVals = new List<CircleGaugeMulti.CircSegm>();
#endregion Protected Fields
@@ -158,9 +144,10 @@ namespace MP_TAB3.Components
if (firstRender)
{
//await getWDim();
StateHasChanged();
await InvokeAsync(StateHasChanged);
}
isLoading = RecMSE == null;
isMobile = await JSRuntime.InvokeAsync<bool>("isDevice");
await Task.Delay(1);
//return base.OnAfterRenderAsync(firstRender);
}
@@ -244,6 +231,14 @@ namespace MP_TAB3.Components
NavMan.NavigateTo($"machine-detail");
}
/// <summary>
/// Toggle visibilità button
/// </summary>
protected void ToggleDraw()
{
showDraw = !showDraw;
}
#endregion Protected Methods
#region Private Fields
@@ -254,6 +249,17 @@ namespace MP_TAB3.Components
#endregion Private Fields
#region Private Properties
/// <summary>
/// Boolean Mobile vs Desktop
/// </summary>
private bool isMobile { get; set; }
private bool showDraw { get; set; } = false;
#endregion Private Properties
#region Private Methods
private string cssComStatus(string semaforo, DateTime? lastUpdateN)
+1
View File
@@ -36,6 +36,7 @@
<a class="dismiss">🗙</a>
</div>
<script src="lib/Utils.js"></script>
<script src="lib/WindowSize.js"></script>
<script src="lib/bootstrap/js/bootstrap.bundle.js"></script>
+3
View File
@@ -0,0 +1,3 @@
function isDevice() {
return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile/i.test(navigator.userAgent);
}