8c906a7b00
- spostato joint in ogni anta - cambiato interfaccia della singola anta
204 lines
5.6 KiB
C#
204 lines
5.6 KiB
C#
using EgwCoreLib.Razor;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using WebWindowComplex.Models;
|
|
using static WebWindowComplex.Json.WindowConst;
|
|
|
|
namespace WebWindowComplex.Compo
|
|
{
|
|
public partial class AreaSash
|
|
{
|
|
/// <summary>
|
|
/// Sash group corrente
|
|
/// </summary>
|
|
[Parameter]
|
|
public Sash CurrSashGroup { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Sash dimension corrente
|
|
/// </summary>
|
|
[Parameter]
|
|
public SashDimension CurrSashDim { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Indice della sash corrente
|
|
/// </summary>
|
|
[Parameter]
|
|
public int IndexSash { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Evento per cambiare l'anta su cui è presente la maniglia
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<DataChangeHandle> EC_ChangeHandle { get; set; }
|
|
|
|
/// <summary>
|
|
/// Evento per aggiornare sash dimension
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<SashDimension> EC_UpdateSashDim { get; set; }
|
|
|
|
/// <summary>
|
|
/// Evento per cambiare l'anta su cui è presente la maniglia
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<DataCopyContentSash> EC_CopyContentSash { get; set; }
|
|
|
|
/// <summary>
|
|
/// Anta corrente
|
|
/// </summary>
|
|
public Area CurrAnta
|
|
{
|
|
get
|
|
{
|
|
if(CurrSashGroup.AreaList[IndexSash] is Splitted)
|
|
{
|
|
return CurrSashGroup.AreaList[IndexSash];
|
|
}
|
|
else
|
|
{
|
|
return CurrSashGroup;
|
|
}
|
|
}
|
|
set
|
|
{
|
|
CurrAnta = value;
|
|
}
|
|
}
|
|
|
|
public int CssDecimals()
|
|
{
|
|
switch (CurrSashDim.MeasureType)
|
|
{
|
|
case Json.WindowConst.MeasureTypes.ABSOLUT:
|
|
{
|
|
return 2;
|
|
}
|
|
case Json.WindowConst.MeasureTypes.PROPORTIONAL:
|
|
{
|
|
return 0;
|
|
}
|
|
case Json.WindowConst.MeasureTypes.PERCENTAGE:
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sollevo evento richiesta per cambiare tutti i Joint
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private async Task ChangeAllJoints(Json.WindowConst.Joints JointType)
|
|
{
|
|
foreach(var item in CurrSashDim.JointList)
|
|
item.SetSelJointType(JointType);
|
|
await EC_UpdateSashDim.InvokeAsync(CurrSashDim);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Report aggiornamento joint
|
|
/// </summary>
|
|
/// <param name="updRec"></param>
|
|
/// <returns></returns>
|
|
private async Task UpdateJoint(Joint updRec)
|
|
{
|
|
// cerco il record
|
|
var currRec = CurrSashDim.JointList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex);
|
|
// lo aggiorno
|
|
if (updRec != null)
|
|
{
|
|
currRec = updRec;
|
|
await EC_UpdateSashDim.InvokeAsync(CurrSashDim);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sollevo evento per cambiare l'anta su cui è presente la maniglia
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private async Task RaiseChangeHandle(SashDimension sashDim, Sash currSash)
|
|
{
|
|
var Args = new DataChangeHandle
|
|
{
|
|
currSashDimension = sashDim,
|
|
currItem = currSash,
|
|
};
|
|
await EC_ChangeHandle.InvokeAsync(Args);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sollevo evento per cambiare l'anta su cui è presente la maniglia
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private async Task RaiseCopyContentSash(int indexC, int indexM)
|
|
{
|
|
var Args = new DataCopyContentSash
|
|
{
|
|
currItem = CurrSashGroup,
|
|
indexCopy = indexC,
|
|
indexModify = indexM,
|
|
};
|
|
await EC_CopyContentSash.InvokeAsync(Args);
|
|
}
|
|
|
|
private bool JointCollapsed { get; set; } = true;
|
|
|
|
private async Task changeCollapsed()
|
|
{
|
|
JointCollapsed = !JointCollapsed;
|
|
}
|
|
|
|
private string jointCollapsedIcon
|
|
{
|
|
get => JointCollapsed ? "↓" : "↑";
|
|
}
|
|
|
|
private string ButtonJointCss(WebWindowComplex.Json.WindowConst.Joints type)
|
|
{
|
|
foreach (var item in CurrSashDim.JointList)
|
|
{
|
|
if (!item.SelJointType.Equals(type))
|
|
return "btn btn-outline-secondary btn-sm";
|
|
}
|
|
return "btn btn-secondary btn-sm";
|
|
}
|
|
|
|
private enum ModeView
|
|
{
|
|
NULL = 0,
|
|
View = 1,
|
|
Edit = 2
|
|
}
|
|
|
|
private ModeView mode = ModeView.View;
|
|
private void doEdit()
|
|
{
|
|
mode = ModeView.Edit;
|
|
StateHasChanged();
|
|
}
|
|
protected void ClosePopup()
|
|
{
|
|
mode = ModeView.View;
|
|
}
|
|
}
|
|
|
|
public class DataChangeHandle
|
|
{
|
|
public SashDimension currSashDimension { get; set; } = null!;
|
|
public Sash currItem { get; set; } = null!;
|
|
|
|
}
|
|
|
|
public class DataCopyContentSash
|
|
{
|
|
public Sash currItem { get; set; } = null!;
|
|
|
|
public int indexCopy { get; set; } = 0;
|
|
|
|
public int indexModify { get; set; } = 0;
|
|
|
|
}
|
|
} |