Files
zaccaria.majid 2fcc24f3be fix warning
2023-09-06 17:10:11 +02:00

163 lines
5.5 KiB
Plaintext

@using WebDoorCreator.Data.Services;
@using WebDoorCreator.UI.Components.SvgComp
@using WebDoorCreator.UI.Data
@page "/TestPage"
@inject WebDoorCreatorService WDCService
<h3>TestPage</h3>
<button @onclick="()=>populateHws()">Pop Hw</button>
<button @onclick="()=>scanB()">Scan Dir New</button>
<button @onclick="()=>save()">Save</button>
@*<CopyToClipboard Text="PROVATEST" AddSlash="true"></CopyToClipboard>*@
<div class="row mx-2">
@for (int i = 0; i < 8; i++)
{
stepText = $"Block_{idxObj:00}";
<div class="col px-0">
<StepArrow ObjId="@idxObj" StepText="@stepText" BlockStyle="@blockStyle(idxObj)" ObjW="500" ObjH="100"></StepArrow>
</div>
idxObj++;
}
</div>
@if(tempDOT != null)
{
@foreach (var item in tempDOT)
{
<div>@($"{Path.GetFileName(item.OpCode)} {item.status} {item.FileMD5}")</div>
}
}
@*<div class="row my-2">
<div class="col-4">
<DoorSvgObj DoorId="196" ColorLine="#8E44AD" LineWidth="8" ObjH="200" ObjW="900" ClassLeftText="col-10 fs-1 fw-bold" ClassRightText="col-2" EC_ExeFunct="ExecDoor" ObjId="1" TextData="@msgList" Message1="messaggio 1" Message2="messaggio 2" ShowOptions="true" ImagePath="@svgUrl(196)"></DoorSvgObj>
</div>
<div class="col-4">
<DoorSvgObj DoorId="199" ColorLine="#8E44AD" LineWidth="8" ObjH="200" ObjW="900" ClassLeftText="col-10 fs-1 fw-bold" ClassRightText="col-2" EC_ExeFunct="ExecDoor" ObjId="1" TextData="@msgList" Message1="messaggio 1" Message2="messaggio 2" ShowOptions="true" ShowPlusMinus="true" ImagePath="@svgUrl(199)"></DoorSvgObj>
</div>
<div class="col-4">
<DoorSvgObj DoorId="186" ColorLine="#8E44AD" LineWidth="8" ObjH="200" ObjW="900" ClassLeftText="col-10 fs-1 fw-bold" ClassRightText="col-2" EC_ExeFunct="ExecDoor" ObjId="2" TextData="@msgList" Message1="messaggio 1" Message2="messaggio 2" ShowPlusMinus="true" ImagePath="@svgUrl(186)"></DoorSvgObj>
</div>
</div>*@
<div class="row my-2">
<div class="col">
<b>@lastMessage</b>
</div>
</div>
<div class="row my-2">
<div class="col">
<HwSvgObj LineColor="#CFD8DC" LineWidth="8" ObjH="200" ObjW="700" EC_ExeFunct="@exeFun" ObjId="21" ItemName="Flush Pull" ItemCount="2" ImagePath="@svgUrl(196)"></HwSvgObj>
</div>
<div class="col">
<HwSvgObj LineColor="#CFD8DC" LineWidth="8" ObjH="200" ObjW="700" EC_ExeFunct="@exeFun" ObjId="22" ItemName="Hinge" ItemCount="0" ImagePath="images/icons/ExitWhite.svg" TextCss="text-secondary"></HwSvgObj>
</div>
<div class="col">
<HwSvgObj LineColor="#CFD8DC" LineWidth="8" ObjH="200" ObjW="700" EC_ExeFunct="@exeFun" ObjId="23" ItemName="HingeSel" ItemCount="0" ImagePath="images/icons/PlusWhite.svg" ShowPlus="false" BgColorFrom="#339833" BgColorTo="#98FF98"></HwSvgObj>
</div>
<div class="col">
<HwSvgObj LineColor="#CFD8DC" LineWidth="8" ObjH="200" ObjW="700" EC_ExeFunct="@exeFun" ObjId="25" ItemName="HingePlus" ItemCount="0" ImagePath="images/icons/PlusWhite.svg" ShowPlus="true"></HwSvgObj>
</div>
<div class="col">
<HwSvgObj LineColor="#CFD8DC" LineWidth="8" ObjH="200" ObjW="700" EC_ExeFunct="@exeFun" ObjId="24" ItemName="Hinge" ItemCount="0" ShowPlus="true" ImagePath="@svgUrl(186)"></HwSvgObj>
</div>
</div>
<div class="row my-2">
@if (DoorsList == null)
{
<LoadingData></LoadingData>
}
else
{
foreach (var door in DoorsList)
{
<div class="col-1 text-center border rounded-2 m-2" style="height:100%; background: linear-gradient(#AFCFD1, #92B2C4);">
<b>@door.DoorId</b><br />
<img width="80" height="80" src="@svgUrl(door.DoorId)" />
</div>
}
}
</div>
@code {
protected string lastMessage { get; set; } = "";
protected string svgUrl(int doorId)
{
return $"api/DoorImage/GetImage.svg?DoorId={doorId}";
}
protected int idxObj { get; set; } = 1;
protected string stepText { get; set; } = "---";
protected string blockStyle(int idx)
{
string answ = "";
int resto = idx % 3;
switch (resto)
{
case 1:
answ = "fill:rgb(0,255,0);";
break;
case 2:
answ = "fill:rgb(0,0,255);";
break;
case 0:
default:
answ = "fill:rgb(255,0,0)";
break;
}
return answ;
}
protected Dictionary<string, string> msgList = new Dictionary<string, string>();
protected List<DoorOpTypeModel> tempDOT = new List<DoorOpTypeModel>();
protected override async Task OnInitializedAsync()
{
msgList = new Dictionary<string, string>();
msgList.Add("T1", "Titolo");
msgList.Add("M1", "Messaggio 1");
msgList.Add("M2", "MEssaggio 2");
DoorsList = await WDCService.DoorGetLast(100);
}
protected List<DoorModel>? DoorsList { get; set; } = null;
protected async Task ExecDoor(DoorSvgObj.DoorAct currAct)
{
lastMessage = $"DoorId: {currAct.DoorId} | Actio req: {currAct.Action}";
await Task.Delay(1);
}
protected async Task exeFun(HwSvgObj.ActionReq action)
{
await Task.Delay(1);
}
protected async Task scanB()
{
await Task.Delay(1);
tempDOT.Clear();
//tempDOT = await WDCService.scanAndCompare();
}
protected async Task save()
{
await WDCService.DoorOpTypeAddRange(tempDOT);
}
protected async Task populateHws()
{
await WDCService.populateHws();
}
}