Aggiunto componente semplificato (per utente base)
This commit is contained in:
@@ -21,44 +21,24 @@
|
||||
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
|
||||
<nav class="flex-column">
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="Home" Match="NavLinkMatch.All">
|
||||
<span class="bi bi-house-fill px-2 fs-4" aria-hidden="true"></span>
|
||||
<NavLink class="nav-link" href="EditJWD" Match="NavLinkMatch.All">
|
||||
<span class="fa-solid fa-gear px-2 fs-4" aria-hidden="true"></span>
|
||||
@if (showText)
|
||||
{
|
||||
<span class="@hideText">Home</span>
|
||||
<span class="@hideText">EditJWD</span>
|
||||
}
|
||||
</NavLink>
|
||||
</div>
|
||||
@* <div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="TestComponentTemplate">
|
||||
<span class="bi bi-house-fill px-2 fs-4" aria-hidden="true"></span> <span class="@hideText">TestTemplate</span>
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="TestComponentJWD">
|
||||
<span class="bi bi-house-fill px-2 fs-4" aria-hidden="true"></span> <span class="@hideText">TestJWD</span>
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="Gerarchia">
|
||||
<span class="bi bi-house-fill px-2 fs-4" aria-hidden="true"></span> <span class="@hideText"> Gerarchia</span>
|
||||
</NavLink>
|
||||
</div> *@
|
||||
<div class="nav-item px-3">
|
||||
@* <div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="EditJWD">
|
||||
<span class="fa-solid fa-gear px-2 fs-4" aria-hidden="true"></span> <span class="@hideText">EditJWD</span>
|
||||
</NavLink>
|
||||
</div>
|
||||
@* <div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="Aedifica">
|
||||
<span class="bi bi-house-fill px-2 fs-4" aria-hidden="true"></span> <span class="@hideText">Aedifica</span>
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="uitest">
|
||||
<span class="bi bi-house-fill px-2 fs-4" aria-hidden="true"></span> <span class="@hideText">UI Testing</span>
|
||||
</NavLink>
|
||||
</div> *@
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="SimpleEdit">
|
||||
<span class="fa-solid fa-pencil px-2 fs-4" aria-hidden="true"></span> <span class="@hideText">SimpleEdit</span>
|
||||
</NavLink>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@page "/EditJWD"
|
||||
@page "/"
|
||||
@page "/EditJWD"
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>EditJWD</PageTitle>
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
@page "/Error"
|
||||
@using System.Diagnostics
|
||||
|
||||
<PageTitle>Error</PageTitle>
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
|
||||
@code{
|
||||
[CascadingParameter]
|
||||
private HttpContext? HttpContext { get; set; }
|
||||
|
||||
private string? RequestId { get; set; }
|
||||
private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
|
||||
protected override void OnInitialized() =>
|
||||
RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
@page "/Gerarchia"
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>Gerarchia</PageTitle>
|
||||
|
||||
<WebWindowComplex.TableComp IN_FamilyHardwareList="@AvailFamilyHardwareList"
|
||||
IN_SelFamilyHardware="@SelFamilyHardware"
|
||||
IN_HardwareList="@AvailHardwareList"
|
||||
IN_ColorMaterialList="@AvailColorMaterialList"
|
||||
IN_SelColorMaterial="@SelColorMaterial"
|
||||
IN_MaterialList="@AvailMaterialList"
|
||||
IN_SelMaterial="@SelMaterial"
|
||||
IN_GlassList="@AvailGlassList"
|
||||
IN_SelGlass="@SelGlass"
|
||||
EC_req="SaveJWD"
|
||||
EC_OnSelectedTemplate="SetTemplate"
|
||||
LiveSVG="@currSvg">
|
||||
</WebWindowComplex.TableComp>
|
||||
@*
|
||||
<p>
|
||||
@m_CurrArgs.GetValueOrDefault("Jwd")
|
||||
</p> *@
|
||||
@@ -1,182 +0,0 @@
|
||||
using EgwCoreLib.Lux.Core;
|
||||
using EgwCoreLib.Lux.Core.RestPayload;
|
||||
using EgwCoreLib.Lux.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using System.Diagnostics;
|
||||
using System.Security.AccessControl;
|
||||
using Egw.Window.Data;
|
||||
using WebWindowComplex;
|
||||
using WebWindowComplex.DTO;
|
||||
|
||||
namespace Test.UI.Components.Pages
|
||||
{
|
||||
public partial class Gerarchia : IDisposable
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string InitialJwd = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
DLService.PipeSvg.EA_NewMessage -= PipeSvg_EA_NewMessage;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string currJwd = "...";
|
||||
protected Dictionary<string, string> m_CurrArgs = new Dictionary<string, string>();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
protected List<Hardware> AvailHardwareList { get; set; } = new List<Hardware>();
|
||||
protected List<string> AvailFamilyHardwareList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("Natura"),
|
||||
new string("Optima")
|
||||
};
|
||||
protected List<string> AvailColorMaterialList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("White"),
|
||||
new string("Black"),
|
||||
new string("Blu")
|
||||
};
|
||||
protected List<string> AvailMaterialList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("Pine"),
|
||||
new string("Fir")
|
||||
};
|
||||
protected List<string> AvailGlassList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("4/12/4"),
|
||||
new string("4/16/4"),
|
||||
new string("4/12/4/12/4"),
|
||||
new string("4/16/4/16/4"),
|
||||
new string("4T/12/4T"),
|
||||
new string("4T/16/4T")
|
||||
};
|
||||
protected string SelFamilyHardware { get; set; } = "";
|
||||
protected string SelColorMaterial { get; set; } = "";
|
||||
protected string SelMaterial { get; set; } = "";
|
||||
protected string SelGlass { get; set; } = "";
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration Config { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected DataLayerServices DLService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected ImageCacheService ICService { get; set; } = null!;
|
||||
|
||||
protected MarkupString JsonSer
|
||||
{
|
||||
get => (MarkupString)currJwd.Replace(Environment.NewLine, "<br/>").Replace(" ", " ");
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ConfInit();
|
||||
SelFamilyHardware = "Natura";
|
||||
SelColorMaterial = "Black";
|
||||
SelMaterial = "Pine";
|
||||
SelGlass = "4T/16/4T";
|
||||
DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string apiUrl = "";
|
||||
private string calcTag = "";
|
||||
private string CalcUid = "CurrWindow";
|
||||
private string cFileTemplate = "Data/Setup.json";
|
||||
private string cFileHardware = "Hardware/Setup.json";
|
||||
private string currSvg = "";
|
||||
|
||||
private string imgBasePath = "";
|
||||
private string GenericBasePath = "";
|
||||
|
||||
private string subChannel = "";
|
||||
|
||||
private string windowUid = "CurrWindow";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void PipeSvg_EA_NewMessage(object? sender, EventArgs e)
|
||||
{
|
||||
// aggiorno visualizzazione
|
||||
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||
// conversione on-the-fly SVG da mostrare
|
||||
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
||||
{
|
||||
if (currArgs.msgUid.Equals($"{subChannel}:{windowUid}"))
|
||||
{
|
||||
currSvg = currArgs.newMessage;
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private void ConfInit()
|
||||
{
|
||||
apiUrl = Config.GetValue<string>("ServerConf:Prog.ApiUrl") ?? "";
|
||||
imgBasePath = Config.GetValue<string>("ServerConf:ImageBaseUrl") ?? "";
|
||||
GenericBasePath = Config.GetValue<string>("ServerConf:GenericBaseUrl") ?? "";
|
||||
calcTag = Config.GetValue<string>("ServerConf:CalcTag") ?? "";
|
||||
subChannel = Config.GetValue<string>("ServerConf:SvgChannel") ?? "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rilettura dati
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task ReloadData()
|
||||
{
|
||||
//return base.OnInitializedAsync();
|
||||
AvailHardwareList = new List<Hardware>();
|
||||
if (File.Exists(cFileHardware))
|
||||
{
|
||||
string rawValHW = File.ReadAllText(cFileHardware);
|
||||
var rawListHW = JsonConvert.DeserializeObject<List<Hardware>>(rawValHW) ?? new List<Hardware>();
|
||||
foreach (var item in rawListHW)
|
||||
{
|
||||
AvailHardwareList.Add(item);
|
||||
}
|
||||
}
|
||||
await Task.Delay(100);
|
||||
}
|
||||
|
||||
private async Task SaveJWD(Dictionary<string, string> CurrArgs)
|
||||
{
|
||||
m_CurrArgs = CurrArgs;
|
||||
// chiamo la chiamata POST alla API, che manda la richiesta via REDIS
|
||||
if (currJwd != null)
|
||||
{
|
||||
CalcRequestDTO calcRequestDTO = new CalcRequestDTO();
|
||||
calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW;
|
||||
calcRequestDTO.DictExec = m_CurrArgs;
|
||||
await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{CalcUid}", calcRequestDTO);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
@page "/"
|
||||
@page "/Home"
|
||||
@page "/Home"
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>Select template</PageTitle>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
@page "/SimpleEdit"
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>SimpleEdit</PageTitle>
|
||||
|
||||
<WebWindowTest.Test ListPayload="SetupList"
|
||||
LiveData="CurrData"
|
||||
EC_ActionReq="DoAction"
|
||||
EC_DoUpdate="ExecRequest"
|
||||
EC_OnClose="CloseObj">
|
||||
</WebWindowTest.Test>
|
||||
|
||||
|
||||
@if (!string.IsNullOrEmpty(outClose))
|
||||
{
|
||||
<div class="alert alert-danger fs-4">
|
||||
@outClose
|
||||
</div>
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(outSave))
|
||||
{
|
||||
<div class="alert alert-success fs-4">
|
||||
@outSave
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body small">
|
||||
@JsonSer
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,351 @@
|
||||
using Egw.Window.Data;
|
||||
using EgwCoreLib.Lux.Core;
|
||||
using EgwCoreLib.Lux.Core.RestPayload;
|
||||
using EgwCoreLib.Lux.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Newtonsoft.Json;
|
||||
using WebWindowTest.DTO;
|
||||
using static WebWindowTest.LayoutConst;
|
||||
|
||||
namespace Test.UI.Components.Pages
|
||||
{
|
||||
public partial class SimpleEdit : IDisposable
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public string InitialJwd = "";
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
DLService.PipeSvg.EA_NewMessage -= PipeSvg_EA_NewMessage;
|
||||
DLService.PipeShape.EA_NewMessage -= PipeShape_EA_NewMessage;
|
||||
DLService.PipeHwOpt.EA_NewMessage -= PipeHwOption_EA_NewMessage;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Predisposizione valori live SVG/JWD
|
||||
/// </summary>
|
||||
protected LivePayload CurrData = new LivePayload();
|
||||
|
||||
protected Dictionary<int, string> currGroupShape = new Dictionary<int, string>();
|
||||
protected Dictionary<int, string> currHwOption = new Dictionary<int, string>();
|
||||
protected string currJwd = "...";
|
||||
protected Dictionary<string, string> m_CurrArgs = new Dictionary<string, string>();
|
||||
protected string prevJwd = "";
|
||||
|
||||
/// <summary>
|
||||
/// Configurazione elenchi anagrafiche
|
||||
/// </summary>
|
||||
protected BaseListPayload SetupList = new BaseListPayload();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected List<string> AvailColorMaterialList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("White"),
|
||||
new string("Wood"),
|
||||
new string("Black"),
|
||||
new string("Blu")
|
||||
};
|
||||
|
||||
protected List<string> AvailFamilyHardwareList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("ArTech"),
|
||||
new string("ArTechPlana")
|
||||
};
|
||||
|
||||
protected List<string> AvailGlassList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("Vetro BE 2S 4/12/4"),
|
||||
new string("Vetro BE 2S 4/16/4"),
|
||||
new string("Vetro BE 3S 4/12/4/12/4"),
|
||||
new string("Vetro BE 3S 4/16/4/16/4"),
|
||||
new string("Vetro BE 2S 4T/12/4T"),
|
||||
new string("Vetro BE 2S 4T/16/4T")
|
||||
};
|
||||
|
||||
protected List<Hardware> AvailHardwareList { get; set; } = new List<Hardware>();
|
||||
|
||||
protected List<string> AvailMaterialList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("Pino"),
|
||||
new string("Abete")
|
||||
};
|
||||
|
||||
protected List<string> AvailProfileList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("Profilo78"),
|
||||
new string("ProfiloSaomad")
|
||||
};
|
||||
|
||||
protected Dictionary<string, List<Threshold>> AvailThreshold { get; set; } = new Dictionary<string, List<Threshold>>()
|
||||
{
|
||||
{"Profilo78", new List<Threshold>() { new Threshold(3, "Bottom"), new Threshold(1, "Threshold")}},
|
||||
{"ProfiloSaomad", new List<Threshold>(){ new Threshold(3, "Bottom"), new Threshold(2, "BottomWaterdrip"), new Threshold(1, "Threshold")}}
|
||||
};
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration Config { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected DataLayerServices DLService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected ImageCacheService ICService { get; set; } = null!;
|
||||
|
||||
protected MarkupString JsonSer
|
||||
{
|
||||
get => (MarkupString)currJwd.Replace(Environment.NewLine, "<br/>").Replace(" ", " ");
|
||||
}
|
||||
|
||||
protected string SelColorMaterial { get; set; } = "";
|
||||
protected string SelFamilyHardware { get; set; } = "";
|
||||
protected string SelGlass { get; set; } = "";
|
||||
protected string SelMaterial { get; set; } = "";
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
// JS interop or data fetches go here
|
||||
isInteractive = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ConfInit();
|
||||
Random random = new Random();
|
||||
CalcUid = Convert.ToString(random.Next(1000, 10000));
|
||||
windowUid = CalcUid;
|
||||
//InitialJwd = File.ReadAllText("Data\\FinestraSplitGrid.jwd");
|
||||
InitialJwd = File.ReadAllText("Data\\AntaDoppia.jwd");
|
||||
//InitialJwd = File.ReadAllText("Data\\ArcoAntaDoppia.jwd");
|
||||
currJwd = InitialJwd;
|
||||
// rileggo altri dati
|
||||
await ReloadData();
|
||||
// preparo conf oggetti x controllo
|
||||
SetupList = new BaseListPayload()
|
||||
{
|
||||
ColorMaterial = AvailColorMaterialList,
|
||||
FamilyHardware = AvailFamilyHardwareList,
|
||||
Glass = AvailGlassList,
|
||||
Hardware = AvailHardwareList,
|
||||
Material = AvailMaterialList,
|
||||
Profile = AvailProfileList,
|
||||
Threshold = AvailThreshold
|
||||
};
|
||||
CurrData = new LivePayload()
|
||||
{
|
||||
CurrJwd = InitialJwd,
|
||||
SvgPreview = currSvg,
|
||||
DictShape = currGroupShape,
|
||||
DictOptionsXml = currHwOption
|
||||
};
|
||||
DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage;
|
||||
DLService.PipeShape.EA_NewMessage += PipeShape_EA_NewMessage;
|
||||
DLService.PipeHwOpt.EA_NewMessage += PipeHwOption_EA_NewMessage;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string apiUrl = "";
|
||||
private string calcTag = "";
|
||||
private string CalcUid = "CurrWindow";
|
||||
private string windowUid = "CurrWindow";
|
||||
private string cFileHardware = "Hardware/Setup.json";
|
||||
private string currSvg = "";
|
||||
private string GenericBasePath = "";
|
||||
|
||||
/// <summary>
|
||||
/// Semaforo x definire se sia già in modalità ionterattiva o di prerendering
|
||||
/// </summary>
|
||||
private bool isInteractive = false;
|
||||
|
||||
private string outClose = "";
|
||||
private string outSave = "";
|
||||
|
||||
private string imgBasePath = "";
|
||||
|
||||
private string channelHwOpt = "";
|
||||
private string channelShape = "";
|
||||
private string channelSvg = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Effettua chiusura oggetto con eventuale save
|
||||
/// </summary>
|
||||
/// <param name="reqSave"></param>
|
||||
private void CloseObj(bool reqSave)
|
||||
{
|
||||
outClose = !reqSave ? "Richiesto chiusura!" : "";
|
||||
outSave = reqSave ? "Richiesto salvataggio!" : "";
|
||||
}
|
||||
|
||||
private void ConfInit()
|
||||
{
|
||||
apiUrl = Config.GetValue<string>("ServerConf:Prog.ApiUrl") ?? "";
|
||||
imgBasePath = Config.GetValue<string>("ServerConf:ImageBaseUrl") ?? "";
|
||||
GenericBasePath = Config.GetValue<string>("ServerConf:GenericBaseUrl") ?? "";
|
||||
calcTag = Config.GetValue<string>("ServerConf:CalcTag") ?? "";
|
||||
channelSvg = Config.GetValue<string>("ServerConf:ChannelSvg") ?? "";
|
||||
channelShape = Config.GetValue<string>("ServerConf:ChannelShape") ?? "";
|
||||
channelHwOpt = Config.GetValue<string>("ServerConf:ChannelHwOpt") ?? "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esecuzione azione richiesta
|
||||
/// </summary>
|
||||
/// <param name="actReq">Azione richiesta</param>
|
||||
private void DoAction(DataAction actReq)
|
||||
{
|
||||
switch (actReq)
|
||||
{
|
||||
case DataAction.None:
|
||||
break;
|
||||
|
||||
case DataAction.ResetDictShape:
|
||||
CurrData.DictShape = new Dictionary<int, string>();
|
||||
break;
|
||||
|
||||
case DataAction.ResetHwOpt:
|
||||
CurrData.DictOptionsXml = new Dictionary<int, string>();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esecuzione richiesta
|
||||
/// </summary>
|
||||
/// <param name="CurrArgs"></param>
|
||||
/// <returns></returns>
|
||||
private async Task ExecRequest(Dictionary<string, string> CurrArgs)
|
||||
{
|
||||
// Proseguo solo se sono in interattivo (NO prerender pagina)
|
||||
if (isInteractive)
|
||||
{
|
||||
outClose = "";
|
||||
outSave = "";
|
||||
// verifico se contiene JWD, lo aggiorno
|
||||
if (CurrArgs.ContainsKey("SerializedData"))
|
||||
{
|
||||
currJwd = CurrArgs["SerializedData"];
|
||||
CurrData.CurrJwd = currJwd;
|
||||
}
|
||||
// se il SSE variato --> invio
|
||||
if (!currJwd.Equals(prevJwd) || !EgwCoreLib.Utils.DictUtils.DictAreEqual(m_CurrArgs, CurrArgs))
|
||||
{
|
||||
m_CurrArgs = CurrArgs;
|
||||
prevJwd = currJwd;
|
||||
CalcRequestDTO calcRequestDTO = new CalcRequestDTO();
|
||||
calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW;
|
||||
calcRequestDTO.DictExec = m_CurrArgs;
|
||||
// chiamo la chiamata POST alla API, che manda la richiesta via REDIS
|
||||
await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{CalcUid}", calcRequestDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void PipeHwOption_EA_NewMessage(object? sender, EventArgs e)
|
||||
{
|
||||
// aggiorno visualizzazione
|
||||
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||
// conversione on-the-fly SVG da mostrare
|
||||
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
||||
{
|
||||
if (currArgs.msgUid.StartsWith($"{channelHwOpt}:{windowUid}") && currArgs.newMessage.Length > 2)
|
||||
{
|
||||
// deserializzo il dizionario delle risposte...
|
||||
Dictionary<int, string> rawDict = JsonConvert.DeserializeObject<Dictionary<int, string>>(currArgs.newMessage) ?? new Dictionary<int, string>();
|
||||
if (rawDict.Count > 0)
|
||||
{
|
||||
currHwOption = rawDict;
|
||||
CurrData.DictOptionsXml = currHwOption;
|
||||
}
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private async void PipeShape_EA_NewMessage(object? sender, EventArgs e)
|
||||
{
|
||||
// aggiorno visualizzazione
|
||||
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||
// conversione on-the-fly SVG da mostrare
|
||||
if (!string.IsNullOrEmpty(currArgs.newMessage) && currArgs.newMessage.Length > 2)
|
||||
{
|
||||
if (currArgs.msgUid.StartsWith($"{channelShape}:{windowUid}"))
|
||||
{
|
||||
// deserializzo il dizionario delle risposte...
|
||||
var rawDict = JsonConvert.DeserializeObject<Dictionary<int, string>>(currArgs.newMessage);
|
||||
currGroupShape = rawDict ?? new Dictionary<int, string>();
|
||||
CurrData.DictShape = currGroupShape;
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private async void PipeSvg_EA_NewMessage(object? sender, EventArgs e)
|
||||
{
|
||||
// aggiorno visualizzazione
|
||||
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||
// conversione on-the-fly SVG da mostrare
|
||||
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
||||
{
|
||||
if (currArgs.msgUid.Equals($"{channelSvg}:{windowUid}"))
|
||||
{
|
||||
currSvg = currArgs.newMessage;
|
||||
CurrData.SvgPreview = currArgs.newMessage;
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rilettura dati
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task ReloadData()
|
||||
{
|
||||
//return base.OnInitializedAsync();
|
||||
AvailHardwareList = new List<Hardware>();
|
||||
if (File.Exists(cFileHardware))
|
||||
{
|
||||
string rawValHW = File.ReadAllText(cFileHardware);
|
||||
var rawListHW = JsonConvert.DeserializeObject<List<Hardware>>(rawValHW) ?? new List<Hardware>();
|
||||
foreach (var item in rawListHW)
|
||||
{
|
||||
AvailHardwareList.Add(item);
|
||||
}
|
||||
}
|
||||
await Task.Delay(100);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
@page "/TestComponentJWD"
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>TestComponent</PageTitle>
|
||||
|
||||
<WebWindowTest.Test IN_FamilyHardwareList="@AvailFamilyHardwareList"
|
||||
IN_HardwareList="@AvailHardwareList"
|
||||
IN_ColorMaterialList="@AvailColorMaterialList"
|
||||
IN_MaterialList="@AvailMaterialList"
|
||||
IN_GlassList="@AvailGlassList"
|
||||
EC_OnUpdate="SaveJWD"
|
||||
LiveSVG="@currSvg"
|
||||
CurrJwd="@InitialJwd">
|
||||
</WebWindowTest.Test>
|
||||
|
||||
@*
|
||||
IN_SelGlass="@SelGlass"
|
||||
IN_SelFamilyHardware="@SelFamilyHardware"
|
||||
IN_SelColorMaterial="@SelColorMaterial"
|
||||
IN_SelMaterial="@SelMaterial"
|
||||
*@
|
||||
|
||||
<p>
|
||||
@m_CurrArgs.GetValueOrDefault("Jwd")
|
||||
</p>
|
||||
@@ -1,217 +0,0 @@
|
||||
using EgwCoreLib.Lux.Core;
|
||||
using EgwCoreLib.Lux.Core.RestPayload;
|
||||
using EgwCoreLib.Lux.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using System.Diagnostics;
|
||||
using System.Security.AccessControl;
|
||||
using Egw.Window.Data;
|
||||
using WebWindowTest;
|
||||
using WebWindowTest.DTO;
|
||||
|
||||
namespace Test.UI.Components.Pages
|
||||
{
|
||||
public partial class TestComponentJWD : IDisposable
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string InitialJwd = "";
|
||||
public Template SelTemplate { get; set; } = new Template(0, "---SELECT---", "", "");
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
DLService.PipeSvg.EA_NewMessage -= PipeSvg_EA_NewMessage;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string currJwd = "...";
|
||||
protected Dictionary<string, string> m_CurrArgs = new Dictionary<string, string>();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected List<TemplateSelectDTO> AvailTemplateList { get; set; } = new List<TemplateSelectDTO>();
|
||||
protected List<Hardware> AvailHardwareList { get; set; } = new List<Hardware>();
|
||||
protected List<string> AvailFamilyHardwareList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("Natura"),
|
||||
new string("Optima")
|
||||
};
|
||||
protected List<string> AvailColorMaterialList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("White"),
|
||||
new string("Black"),
|
||||
new string("Blu")
|
||||
};
|
||||
protected List<string> AvailMaterialList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("Pine"),
|
||||
new string("Fir")
|
||||
};
|
||||
protected List<string> AvailGlassList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("4/12/4"),
|
||||
new string("4/16/4"),
|
||||
new string("4/12/4/12/4"),
|
||||
new string("4/16/4/16/4"),
|
||||
new string("4T/12/4T"),
|
||||
new string("4T/16/4T")
|
||||
};
|
||||
protected string SelFamilyHardware { get; set; } = "";
|
||||
protected string SelColorMaterial { get; set; } = "";
|
||||
protected string SelMaterial { get; set; } = "";
|
||||
protected string SelGlass { get; set; } = "";
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration Config { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected DataLayerServices DLService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected ImageCacheService ICService { get; set; } = null!;
|
||||
|
||||
protected MarkupString JsonSer
|
||||
{
|
||||
get => (MarkupString)currJwd.Replace(Environment.NewLine, "<br/>").Replace(" ", " ");
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ConfInit();
|
||||
SelFamilyHardware = "Natura";
|
||||
//SelColorMaterial = "Black";
|
||||
//SelColorMaterial = "Pine";
|
||||
//SelGlass = "4T/16/4T";
|
||||
InitialJwd = File.ReadAllText("Data\\FinDueAnteBottomFisso.jwd");
|
||||
currJwd = InitialJwd;
|
||||
DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string apiUrl = "";
|
||||
private string calcTag = "";
|
||||
private string CalcUid = "CurrWindow";
|
||||
private string cFileTemplate = "Data/Setup.json";
|
||||
private string cFileHardware = "Hardware/Setup.json";
|
||||
private TemplateSelectDTO? currSel = null;
|
||||
private string currSvg = "";
|
||||
|
||||
private string imgBasePath = "";
|
||||
private string GenericBasePath = "";
|
||||
|
||||
private string subChannel = "";
|
||||
|
||||
private string windowUid = "CurrWindow";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void PipeSvg_EA_NewMessage(object? sender, EventArgs e)
|
||||
{
|
||||
// aggiorno visualizzazione
|
||||
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||
// conversione on-the-fly SVG da mostrare
|
||||
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
||||
{
|
||||
if (currArgs.msgUid.Equals($"{subChannel}:{windowUid}"))
|
||||
{
|
||||
currSvg = currArgs.newMessage;
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private void ConfInit()
|
||||
{
|
||||
apiUrl = Config.GetValue<string>("ServerConf:Prog.ApiUrl") ?? "";
|
||||
imgBasePath = Config.GetValue<string>("ServerConf:ImageBaseUrl") ?? "";
|
||||
GenericBasePath = Config.GetValue<string>("ServerConf:GenericBaseUrl") ?? "";
|
||||
calcTag = Config.GetValue<string>("ServerConf:CalcTag") ?? "";
|
||||
subChannel = Config.GetValue<string>("ServerConf:SvgChannel") ?? "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rilettura dati
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task ReloadData()
|
||||
{
|
||||
//return base.OnInitializedAsync();
|
||||
AvailTemplateList = new List<TemplateSelectDTO>();
|
||||
AvailHardwareList = new List<Hardware>();
|
||||
// brutale, da rivedere...
|
||||
if (string.IsNullOrEmpty(InitialJwd))
|
||||
{
|
||||
if (File.Exists(cFileTemplate))
|
||||
{
|
||||
string rawVal = File.ReadAllText(cFileTemplate);
|
||||
var rawList = JsonConvert.DeserializeObject<List<TemplateSelectDTO>>(rawVal) ?? new List<TemplateSelectDTO>();
|
||||
|
||||
// calcolo URL immagini... DTO interno da rivedere?
|
||||
foreach (var item in rawList)
|
||||
{
|
||||
item.ImageUrl = ICService.ImageUrl($"{apiUrl}/{imgBasePath}", false, item.SVGFileName);
|
||||
AvailTemplateList.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (File.Exists(cFileHardware))
|
||||
{
|
||||
string rawValHW = File.ReadAllText(cFileHardware);
|
||||
var rawListHW = JsonConvert.DeserializeObject<List<Hardware>>(rawValHW) ?? new List<Hardware>();
|
||||
foreach (var item in rawListHW)
|
||||
{
|
||||
AvailHardwareList.Add(item);
|
||||
}
|
||||
}
|
||||
await Task.Delay(100);
|
||||
}
|
||||
|
||||
private async Task SaveJWD(Dictionary<string, string> CurrArgs)
|
||||
{
|
||||
m_CurrArgs = CurrArgs;
|
||||
// chiamo la chiamata POST alla API, che manda la richiesta via REDIS
|
||||
if (currJwd != null)
|
||||
{
|
||||
CalcRequestDTO calcRequestDTO = new CalcRequestDTO();
|
||||
calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW;
|
||||
calcRequestDTO.DictExec = m_CurrArgs;
|
||||
await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{CalcUid}", calcRequestDTO);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetTemplate(TemplateSelectDTO selTemp)
|
||||
{
|
||||
string rawVal = "";
|
||||
currSel = selTemp;
|
||||
// brutale,d a rivedere...
|
||||
if (File.Exists(selTemp.JwdFileName))
|
||||
{
|
||||
rawVal = File.ReadAllText(selTemp.JwdFileName);
|
||||
}
|
||||
SelTemplate = new Template(selTemp.Index, selTemp.Description, selTemp.SVGFileName, rawVal);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
@page "/TestComponentTemplate"
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>TestComponent</PageTitle>
|
||||
|
||||
<WebWindowTest.Test IN_TemplateDTOList="@AvailTemplateList"
|
||||
IN_SelTemplate="@SelTemplate"
|
||||
IN_FamilyHardwareList="@AvailFamilyHardwareList"
|
||||
IN_SelFamilyHardware="@SelFamilyHardware"
|
||||
IN_HardwareList="@AvailHardwareList"
|
||||
IN_ColorMaterialList="@AvailColorMaterialList"
|
||||
IN_SelColorMaterial="@SelColorMaterial"
|
||||
IN_MaterialList="@AvailMaterialList"
|
||||
IN_SelMaterial="@SelMaterial"
|
||||
IN_GlassList="@AvailGlassList"
|
||||
IN_SelGlass="@SelGlass"
|
||||
EC_OnUpdate="SaveJWD"
|
||||
EC_OnSelectedTemplate="SetTemplate"
|
||||
LiveSVG="@currSvg">
|
||||
</WebWindowTest.Test>
|
||||
|
||||
<p>
|
||||
@m_CurrArgs.GetValueOrDefault("Jwd")
|
||||
</p>
|
||||
@@ -1,215 +0,0 @@
|
||||
using EgwCoreLib.Lux.Core;
|
||||
using EgwCoreLib.Lux.Core.RestPayload;
|
||||
using EgwCoreLib.Lux.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using System.Diagnostics;
|
||||
using System.Security.AccessControl;
|
||||
using Egw.Window.Data;
|
||||
using WebWindowTest;
|
||||
using WebWindowTest.DTO;
|
||||
|
||||
namespace Test.UI.Components.Pages
|
||||
{
|
||||
public partial class TestComponentTemplate : IDisposable
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string InitialJwd = "";
|
||||
public Template SelTemplate { get; set; } = new Template(0, "---SELECT---", "", "");
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
DLService.PipeSvg.EA_NewMessage -= PipeSvg_EA_NewMessage;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string currJwd = "...";
|
||||
protected Dictionary<string, string> m_CurrArgs = new Dictionary<string, string>();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected List<TemplateSelectDTO> AvailTemplateList { get; set; } = new List<TemplateSelectDTO>();
|
||||
protected List<Hardware> AvailHardwareList { get; set; } = new List<Hardware>();
|
||||
protected List<string> AvailFamilyHardwareList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("Natura"),
|
||||
new string("Optima")
|
||||
};
|
||||
protected List<string> AvailColorMaterialList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("White"),
|
||||
new string("Black"),
|
||||
new string("Blu")
|
||||
};
|
||||
protected List<string> AvailMaterialList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("Pine"),
|
||||
new string("Fir")
|
||||
};
|
||||
protected List<string> AvailGlassList { get; set; } = new List<string>()
|
||||
{
|
||||
new string("4/12/4"),
|
||||
new string("4/16/4"),
|
||||
new string("4/12/4/12/4"),
|
||||
new string("4/16/4/16/4"),
|
||||
new string("4T/12/4T"),
|
||||
new string("4T/16/4T")
|
||||
};
|
||||
protected string SelFamilyHardware { get; set; } = "";
|
||||
protected string SelColorMaterial { get; set; } = "";
|
||||
protected string SelMaterial { get; set; } = "";
|
||||
protected string SelGlass { get; set; } = "";
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration Config { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected DataLayerServices DLService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected ImageCacheService ICService { get; set; } = null!;
|
||||
|
||||
protected MarkupString JsonSer
|
||||
{
|
||||
get => (MarkupString)currJwd.Replace(Environment.NewLine, "<br/>").Replace(" ", " ");
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ConfInit();
|
||||
SelFamilyHardware = "Natura";
|
||||
SelColorMaterial = "Black";
|
||||
SelMaterial = "Pine";
|
||||
SelGlass = "4T/16/4T";
|
||||
DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string apiUrl = "";
|
||||
private string calcTag = "";
|
||||
private string CalcUid = "CurrWindow";
|
||||
private string cFileTemplate = "Data/Setup.json";
|
||||
private string cFileHardware = "Hardware/Setup.json";
|
||||
private TemplateSelectDTO? currSel = null;
|
||||
private string currSvg = "";
|
||||
|
||||
private string imgBasePath = "";
|
||||
private string GenericBasePath = "";
|
||||
|
||||
private string subChannel = "";
|
||||
|
||||
private string windowUid = "CurrWindow";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void PipeSvg_EA_NewMessage(object? sender, EventArgs e)
|
||||
{
|
||||
// aggiorno visualizzazione
|
||||
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||
// conversione on-the-fly SVG da mostrare
|
||||
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
||||
{
|
||||
if (currArgs.msgUid.Equals($"{subChannel}:{windowUid}"))
|
||||
{
|
||||
currSvg = currArgs.newMessage;
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private void ConfInit()
|
||||
{
|
||||
apiUrl = Config.GetValue<string>("ServerConf:Prog.ApiUrl") ?? "";
|
||||
imgBasePath = Config.GetValue<string>("ServerConf:ImageBaseUrl") ?? "";
|
||||
GenericBasePath = Config.GetValue<string>("ServerConf:GenericBaseUrl") ?? "";
|
||||
calcTag = Config.GetValue<string>("ServerConf:CalcTag") ?? "";
|
||||
subChannel = Config.GetValue<string>("ServerConf:SvgChannel") ?? "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rilettura dati
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task ReloadData()
|
||||
{
|
||||
//return base.OnInitializedAsync();
|
||||
AvailTemplateList = new List<TemplateSelectDTO>();
|
||||
AvailHardwareList = new List<Hardware>();
|
||||
// brutale, da rivedere...
|
||||
if(string.IsNullOrEmpty(InitialJwd))
|
||||
{
|
||||
if (File.Exists(cFileTemplate))
|
||||
{
|
||||
string rawVal = File.ReadAllText(cFileTemplate);
|
||||
var rawList = JsonConvert.DeserializeObject<List<TemplateSelectDTO>>(rawVal) ?? new List<TemplateSelectDTO>();
|
||||
|
||||
// calcolo URL immagini... DTO interno da rivedere?
|
||||
foreach (var item in rawList)
|
||||
{
|
||||
item.ImageUrl = ICService.ImageUrl($"{apiUrl}/{imgBasePath}", false, item.SVGFileName);
|
||||
AvailTemplateList.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (File.Exists(cFileHardware))
|
||||
{
|
||||
string rawValHW = File.ReadAllText(cFileHardware);
|
||||
var rawListHW = JsonConvert.DeserializeObject<List<Hardware>>(rawValHW) ?? new List<Hardware>();
|
||||
foreach (var item in rawListHW)
|
||||
{
|
||||
AvailHardwareList.Add(item);
|
||||
}
|
||||
}
|
||||
await Task.Delay(100);
|
||||
}
|
||||
|
||||
private async Task SaveJWD(Dictionary<string, string> CurrArgs)
|
||||
{
|
||||
m_CurrArgs = CurrArgs;
|
||||
// chiamo la chiamata POST alla API, che manda la richiesta via REDIS
|
||||
if (currJwd != null)
|
||||
{
|
||||
CalcRequestDTO calcRequestDTO = new CalcRequestDTO();
|
||||
calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW;
|
||||
calcRequestDTO.DictExec = m_CurrArgs;
|
||||
await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{CalcUid}", calcRequestDTO);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetTemplate(TemplateSelectDTO selTemp)
|
||||
{
|
||||
string rawVal = "";
|
||||
currSel = selTemp;
|
||||
// brutale,d a rivedere...
|
||||
if (File.Exists(selTemp.JwdFileName))
|
||||
{
|
||||
rawVal = File.ReadAllText(selTemp.JwdFileName);
|
||||
}
|
||||
SelTemplate = new Template(selTemp.Index, selTemp.Description, selTemp.SVGFileName, rawVal);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>2.7.1.1316</Version>
|
||||
<Version>2.7.1.1615</Version>
|
||||
<Authors>Annamaria Sassi</Authors>
|
||||
<Company>Egalware</Company>
|
||||
<Description>Componente gestione Configurazioni avanzate Window per LUX</Description>
|
||||
@@ -463,6 +463,8 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>2.7.1.1316</Version>
|
||||
<Version>2.7.1.1615</Version>
|
||||
<Authors>Annamaria Sassi</Authors>
|
||||
<Company>Egalware</Company>
|
||||
<Description>Componente gestione JWD per LUX</Description>
|
||||
@@ -586,6 +586,64 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
@using WebWindowTest.Models
|
||||
<div class="card shadow-sm rounded">
|
||||
<div class="card-header bg-light bg-opacity-25">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="col d-flex justify-content-between">
|
||||
<h5>Area frame</h5>
|
||||
</div>
|
||||
<div class="col d-flex justify-content-between">
|
||||
@if (CurrSashList.Count == 0 && CurrSplitList.Count == 0)
|
||||
{
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="RaiseAddSash">Aggiungi sash</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="col d-flex justify-content-between">
|
||||
@if (!(CurrFrameWindow.AreaList[0] is Split))
|
||||
{
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="RaiseAddSplit">Aggiungi split</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,49 +0,0 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using WebWindowTest.Models;
|
||||
|
||||
namespace WebWindowTest.Compo
|
||||
{
|
||||
public partial class AreaFrame
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public Frame CurrFrameWindow { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public List<Sash> CurrSashList { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public List<Split> CurrSplitList { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_AddSash { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_AddSplit { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento richiesta aggiunta sash
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task RaiseAddSash()
|
||||
{
|
||||
await EC_AddSash.InvokeAsync(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento richiesta aggiunta window
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task RaiseAddSplit()
|
||||
{
|
||||
await EC_AddSplit.InvokeAsync(true);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
|
||||
<div class="col-sm-6 my-2">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<h6 class="fw-bold">Frame</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body py-2">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-start fs-5 mb-2">
|
||||
<div class="px-1">
|
||||
<input class="form-check-input ml-auto" type="checkbox" name="NumTrochetti" checked="@insertQty" @onclick="() => IsCheckedQty()">
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">Qty element</span>
|
||||
@if (insertQty)
|
||||
{
|
||||
@* <input type="number" class="form-control" @bind="@ArcElementQty"> *@
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="number" class="form-control" disabled>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-start fs-5 mb-2">
|
||||
<div class="px-1">
|
||||
@* <input class="form-check-input ml-auto" type="checkbox" name="Estremità" checked="@CurrFrame.FrameArcElem.bCutEdge" @onclick="() => IsCheckCutEdge()"> *@
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<label class="form-check-label fs-6 text-dark">Taglio estremità</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-start fs-5 mb-2">
|
||||
<div class="px-1">
|
||||
<input class="form-check-input ml-auto" type="checkbox" name="Sezione" checked="@(!insertQty)" @onclick="() => IsCheckedQty()">
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">Section</span>
|
||||
@if (!insertQty)
|
||||
{
|
||||
@* <input type="number" class="form-control" @bind="@ArcSection"> *@
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="number" class="form-control" disabled>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-start fs-5 mb-2">
|
||||
<div class="px-1">
|
||||
@* <input class="form-check-input ml-auto" type="checkbox" name="Allineamento" checked="@CurrFrame.FrameArcElem.bIsAlign" @onclick="() => IsCheckAlign()"> *@
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<label class="form-check-label fs-6 text-dark">Allineamento</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,84 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Runtime.CompilerServices;
|
||||
using WebWindowTest.DTO;
|
||||
using WebWindowTest.Models;
|
||||
|
||||
namespace WebWindowTest.Compo
|
||||
{
|
||||
public partial class AreaFrameArcElem
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Frame corrente
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Frame CurrFrame { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<Frame> EC_UpdatePreview { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
//protected int ArcElementQty
|
||||
//{
|
||||
// get => CurrFrame.FrameArcElem.nQty;
|
||||
// set
|
||||
// {
|
||||
// CurrFrame.FrameArcElem.nQty = value;
|
||||
// _ = EC_UpdatePreview.InvokeAsync(CurrFrame);
|
||||
// }
|
||||
//}
|
||||
|
||||
//protected double ArcSection
|
||||
//{
|
||||
// get => CurrFrame.FrameArcElem.nSection;
|
||||
// set
|
||||
// {
|
||||
// CurrFrame.FrameArcElem.nSection = value;
|
||||
// _ = EC_UpdatePreview.InvokeAsync(CurrFrame);
|
||||
// }
|
||||
//}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void IsCheckedQty()
|
||||
{
|
||||
insertQty = !insertQty;
|
||||
}
|
||||
|
||||
//protected void IsCheckCutEdge()
|
||||
//{
|
||||
// CurrFrame.FrameArcElem.bCutEdge = !CurrFrame.FrameArcElem.bCutEdge;
|
||||
// _ = EC_UpdatePreview.InvokeAsync(CurrFrame);
|
||||
//}
|
||||
|
||||
//protected void IsCheckAlign()
|
||||
//{
|
||||
// CurrFrame.FrameArcElem.bIsAlign = !CurrFrame.FrameArcElem.bIsAlign;
|
||||
// _ = EC_UpdatePreview.InvokeAsync(CurrFrame);
|
||||
//}
|
||||
|
||||
protected string IsUsedQty()
|
||||
{
|
||||
if (insertQty)
|
||||
return "form-control";
|
||||
else
|
||||
return "form-control disabled";
|
||||
}
|
||||
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool insertQty = false;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,38 +1,54 @@
|
||||
@using static WebWindowTest.Json.WindowConst
|
||||
|
||||
<div class="row mt-2">
|
||||
<div class="row">
|
||||
<div class="col d-flex justify-content-start align-items-center">
|
||||
<h6 class="fw-bold">Hardware option</h6>
|
||||
</div>
|
||||
<div class="col d-flex justify-content-md-end align-items-center">
|
||||
<button class="btn btn-primary" type="button" @onclick="() => changeCollapsed()">+</button>
|
||||
<button class="btn btn-primary btn-sm" type="button" @onclick="() => changeCollapsed()"><i class="@hwIcon"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
@if (isLoadingHwOpt && CurrSash.HwOptionList.Count == 0)
|
||||
@if (!hwOptCollapsed)
|
||||
{
|
||||
<button class="btn btn-secondary" type="button" disabled>Loading</button>
|
||||
}
|
||||
@if (!hwOptCollapsed || !isLoadingHwOpt)
|
||||
{
|
||||
@foreach (var currOpt in CurrSash.HwOptionList)
|
||||
@if (IsLoadingHwOpt)
|
||||
{
|
||||
switch (currOpt.Type)
|
||||
{
|
||||
case HwOptionTypes.COMBO:
|
||||
<div class="col justify-content-start">
|
||||
<p class="placeholder-glow">
|
||||
<span class="placeholder col-12 bg-secondary placeholder-lg my-2"></span>
|
||||
<span class="placeholder col-4 bg-secondary placeholder-lg my-2"></span>
|
||||
<span class="placeholder col-6 bg-secondary placeholder-lg my-2"></span>
|
||||
<span class="placeholder col-7 bg-secondary placeholder-lg my-2"></span>
|
||||
<span class="placeholder col-6 bg-secondary placeholder-lg my-2"></span>
|
||||
<span class="placeholder col-4 bg-secondary placeholder-lg my-2"></span>
|
||||
<span class="placeholder col-8 bg-secondary placeholder-lg my-2"></span>
|
||||
<span class="placeholder col-12 bg-secondary placeholder-lg my-2"></span>
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="scrollspy my-2" tabindex="0"
|
||||
style="position: relative; height: 15rem; overflow-y: auto;">
|
||||
@foreach (var currOpt in CurrSashGroup.HwOptionList)
|
||||
{
|
||||
switch (currOpt.Type)
|
||||
{
|
||||
AGBOptionCombo currOptCombo = (AGBOptionCombo)currOpt;
|
||||
<EditOptionCombo CurrOpt="currOptCombo" EC_Update="RaiseOptCombo"></EditOptionCombo>
|
||||
break;
|
||||
case HwOptionTypes.COMBO:
|
||||
{
|
||||
AGBOptionCombo currOptCombo = (AGBOptionCombo)currOpt;
|
||||
<EditOptionCombo CurrOpt="currOptCombo"></EditOptionCombo>
|
||||
break;
|
||||
}
|
||||
case HwOptionTypes.TEXT:
|
||||
{
|
||||
AGBOptionText currOptText = (AGBOptionText)currOpt;
|
||||
<EditOptionText CurrOpt="currOptText"></EditOptionText>
|
||||
break;
|
||||
}
|
||||
}
|
||||
case HwOptionTypes.TEXT:
|
||||
{
|
||||
AGBOptionText currOptText = (AGBOptionText)currOpt;
|
||||
<EditOptionText CurrOpt="currOptText" EC_Update="RaiseOptText"></EditOptionText>
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
</div>
|
||||
@@ -11,60 +11,60 @@ namespace WebWindowTest.Compo
|
||||
/// <summary>
|
||||
/// Sash corrente rispetto alla lista Sash
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Sash CurrSash { get; set; } = null!;
|
||||
[CascadingParameter(Name = "CurrSashGroup")]
|
||||
public Sash CurrSashGroup { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Evento per aggiornare gli hardware option di tipo combo
|
||||
/// Evento per aggiornare gli hardware option
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<AGBOptionCombo> EC_UpdateHwOptCombo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per aggiornare gli hardware option di tipo text
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<AGBOptionText> EC_UpdateHwOptText { get; set; }
|
||||
public EventCallback<DataUpdateHwOption> EC_UpdateHwOpt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per chiamare la prima volta la lista delle opzioni
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<int> EC_FirstHwOptionList { get; set; }
|
||||
|
||||
private bool isLoadingHwOpt { get; set; }
|
||||
|
||||
private bool hwOptCollapsed { get; set; }
|
||||
[CascadingParameter(Name = "IsLoading")]
|
||||
public List<string> IsLoading { get; set; } = new List<string>();
|
||||
|
||||
private bool hwOptCollapsed { get; set; } = true;
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
hwOptCollapsed = true;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task changeCollapsed()
|
||||
{
|
||||
hwOptCollapsed = !hwOptCollapsed;
|
||||
if(CurrSash.HwOptionList.Count == 0)
|
||||
if (CurrSashGroup.HwOptionList.Count == 0)
|
||||
{
|
||||
isLoadingHwOpt = true;
|
||||
await EC_FirstHwOptionList.InvokeAsync(CurrSash.GroupId);
|
||||
await EC_FirstHwOptionList.InvokeAsync();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Report aggiornamento Option Combo
|
||||
/// </summary>
|
||||
/// <param name="updRec"></param>
|
||||
/// <returns></returns>
|
||||
private async Task RaiseOptCombo(AGBOptionCombo updRec)
|
||||
private string hwIcon
|
||||
{
|
||||
await EC_UpdateHwOptCombo.InvokeAsync(updRec);
|
||||
get => hwOptCollapsed ? "fa-solid fa-chevron-down" : "fa-solid fa-chevron-up";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Report aggiornamento Option Text
|
||||
/// </summary>
|
||||
/// <param name="updRec"></param>
|
||||
/// <returns></returns>
|
||||
private async Task RaiseOptText(AGBOptionText updRec)
|
||||
private bool IsLoadingHwOpt
|
||||
{
|
||||
await EC_UpdateHwOptText.InvokeAsync(updRec);
|
||||
get => IsLoading != null && IsLoading.Count > 0 && IsLoading.Contains("LoadHwOpt");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe per oggetto di aggiornamento delle opzioni
|
||||
/// </summary>
|
||||
public class DataUpdateHwOption
|
||||
{
|
||||
public AGBOptionText AGBOptText { get; set; } = null!;
|
||||
public AGBOptionCombo AGBOptCombo { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
@@ -1,70 +1,129 @@
|
||||
@using WebWindowTest.Models
|
||||
<div class="col-sm-6 my-2">
|
||||
<div class="d-flex justify-content-start align-items-center">
|
||||
<h6 class="fw-bold">Sash @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))</h6>
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text">Tipology</label>
|
||||
<select class="form-select" @bind="@CurrSashDim.SelOpeningTypeIndex">
|
||||
@foreach (var openingType in CurrSashDim.OpeningTypeList)
|
||||
{
|
||||
<option value=@(openingType.Id)>@(openingType.Name)</option>
|
||||
}
|
||||
@* <option value="0">A bandiera sinistra</option>
|
||||
<option value="1">A bandiera destra</option>
|
||||
<option value="2">Ad anta-ribalta sinistra</option>
|
||||
<option value="3">Ad anta-ribalta destra</option>
|
||||
<option value="4">Solo verso alto</option>
|
||||
<option value="5">Solo verso basso</option>
|
||||
<option value="6">Pivot</option>
|
||||
<option value="7">Fissa</option>
|
||||
<option value="8">Complanare sinistra</option>
|
||||
<option value="9">Complanare destra</option>
|
||||
<option value="10">Scorrevole sinistra</option>
|
||||
<option value="11">Scorrevole destra</option> *@
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">Dimension</span>
|
||||
<input type="number" class="form-control" @bind="@CurrSashDim.dDimension">
|
||||
<span class="input-group-text">%</span>
|
||||
</div>
|
||||
<div class="d-flex justify-content-start fs-5 mb-2">
|
||||
<div class="px-1">
|
||||
<input class="form-check-input ml-auto" type="checkbox" name="Handle" checked="@CurrSashDim.bHasHandle" @onclick="() => RaiseChangeHandle(CurrSashDim, CurrSashGroup)">
|
||||
@using EgwCoreLib.Razor
|
||||
@if(mode == ModeView.View)
|
||||
{
|
||||
<div class="col-lg-6 col-md-12 my-2">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<h6 class="fw-bold">Sash @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))</h6>
|
||||
<button class="btn btn-outline-secondary btn-sm" type="button" @onclick="() => doEdit(IndexSash)">Edit</button>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<label class="form-check-label fs-6 text-dark">Handle</label>
|
||||
<div class="input-group mb-2 mt-2">
|
||||
<span class="input-group-text">Tipology</span>
|
||||
<input type="text" readonly class="form-control" value="@(CurrSashDim.OpeningTypeList.ElementAt(OpeningTypeIndex - 1))">
|
||||
</div>
|
||||
</div>
|
||||
@if (!(CurrAnta.AreaList[0] is Split))
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => CurrAnta.AddSplit()">Aggiungi split</button>
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">Dimension</span>
|
||||
<input type="number" class="form-control" value="@Dimension">
|
||||
<select class="form-select" style="max-width:6rem; background-color:#e9ecef" @bind="@MeasureTypeIndex">
|
||||
@foreach (var mType in CurrSashDim.MeasureTypeList)
|
||||
{
|
||||
<option value=@(mType.Id)>
|
||||
@switch (mType.Name)
|
||||
{
|
||||
case "Absolute":
|
||||
{
|
||||
<span class="input-group-text">mm</span>
|
||||
break;
|
||||
}
|
||||
case "Proportional":
|
||||
{
|
||||
<span class="input-group-text">*</span>
|
||||
break;
|
||||
}
|
||||
case "Percentage":
|
||||
{
|
||||
<span class="input-group-text">%</span>
|
||||
break;
|
||||
}
|
||||
}
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="d-flex justify-content-start fs-5 mb-2">
|
||||
<div class="px-1">
|
||||
<input class="form-check-input ml-auto" type="checkbox" name="Handle" checked="@CurrSashDim.bHasHandle" @onclick="() => ChangeHandle()">
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm">Aggiungi inglesina</button>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<label class="form-check-label fs-6 text-dark">Handle</label>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div class="row d-flex justify-content-center align-items-center">
|
||||
@for (int k = 0; k <= CurrSashGroup.SashList.Count - 1; k++)
|
||||
{
|
||||
@if (k != IndexSash)
|
||||
{
|
||||
int IndexCopy = k;
|
||||
int IndexModify = IndexSash;
|
||||
<div class="col-sm-6 my-1">
|
||||
<div class="input-group justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RaiseCopyContentSash(CurrSashGroup, IndexCopy, IndexModify)">Copy sash @(k + 1)</button>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h6 class="fw-bold text-nowrap">Sash @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))</h6>
|
||||
<button type="button" class="btn-close" aria-label="Close" @onclick="() => ClosePopup(IndexSash)"></button>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-12 my-2">
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">Tipology</span>
|
||||
<input type="text" readonly class="form-control" value="@(CurrSashDim.OpeningTypeList.ElementAt(OpeningTypeIndex - 1))">
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">Dimension</span>
|
||||
<input type="number" class="form-control" value="@Dimension">
|
||||
<select class="form-select" style="max-width:6rem; background-color:#e9ecef" @bind="@MeasureTypeIndex">
|
||||
@foreach (var mType in CurrSashDim.MeasureTypeList)
|
||||
{
|
||||
<option value=@(mType.Id)>
|
||||
@switch (mType.Name)
|
||||
{
|
||||
case "Absolute":
|
||||
{
|
||||
<span class="input-group-text">mm</span>
|
||||
break;
|
||||
}
|
||||
case "Proportional":
|
||||
{
|
||||
<span class="input-group-text">*</span>
|
||||
break;
|
||||
}
|
||||
case "Percentage":
|
||||
{
|
||||
<span class="input-group-text">%</span>
|
||||
break;
|
||||
}
|
||||
}
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="d-flex justify-content-start fs-5 mb-2">
|
||||
<div class="px-1">
|
||||
<input class="form-check-input ml-auto" type="checkbox" name="Handle" checked="@CurrSashDim.bHasHandle" @onclick="() => ChangeHandle()">
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<label class="form-check-label fs-6 text-dark">Handle</label>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-12">
|
||||
<div class="row justify-content-between align-items-center">
|
||||
<div class="col d-flex justify-content-start align-items-center">
|
||||
<h6>Joints</h6>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="@ButtonJointCss(WebWindowTest.Json.WindowConst.Joints.ANGLED)" @onclick="() => ChangeAllJoints(WebWindowTest.Json.WindowConst.Joints.ANGLED)">Angled</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="@ButtonJointCss(WebWindowTest.Json.WindowConst.Joints.FULL_H)" @onclick="() => ChangeAllJoints(WebWindowTest.Json.WindowConst.Joints.FULL_H)">Horizontal</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="@ButtonJointCss(WebWindowTest.Json.WindowConst.Joints.FULL_V)" @onclick="() => ChangeAllJoints(WebWindowTest.Json.WindowConst.Joints.FULL_V)">Vertical</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@foreach (Joint joint in CurrSashDim.JointList)
|
||||
{
|
||||
<EditJoint CurrRec="joint" EC_Update="UpdateJoint"></EditJoint>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
using EgwCoreLib.Razor;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using WebWindowTest.Models;
|
||||
using static WebWindowTest.Json.WindowConst;
|
||||
|
||||
namespace WebWindowTest.Compo
|
||||
{
|
||||
@@ -8,7 +12,7 @@ namespace WebWindowTest.Compo
|
||||
/// <summary>
|
||||
/// Sash group corrente
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
[CascadingParameter(Name = "CurrSashGroup")]
|
||||
public Sash CurrSashGroup { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
@@ -17,6 +21,18 @@ namespace WebWindowTest.Compo
|
||||
[Parameter]
|
||||
public SashDimension CurrSashDim { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Lista delle sash
|
||||
/// </summary>
|
||||
[CascadingParameter(Name = "SashList")]
|
||||
public List<Sash> SashList { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Modalità di visualizzazione (view /edit)
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public bool EditMode { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Indice della sash corrente
|
||||
/// </summary>
|
||||
@@ -24,26 +40,33 @@ namespace WebWindowTest.Compo
|
||||
public int IndexSash { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Evento per cambiare l'anta su cui è presente la maniglia
|
||||
/// Evento per aggiornare sash dimension
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<DataChangeHandle> EC_ChangeHandle { get; set; }
|
||||
public EventCallback<SashDimension> EC_UpdateSashDim { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Evento per cambiare l'anta su cui è presente la maniglia
|
||||
/// Evento per aggiornare sash
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<DataCopyContentSash> EC_CopyContentSash { get; set; }
|
||||
public EventCallback<Sash> EC_UpdateSash { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per cambiare modalità di visualizzazione
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<DataChangeMode> EC_EditView { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Anta corrente
|
||||
/// </summary>
|
||||
public Area CurrAnta
|
||||
{
|
||||
public Area CurrAnta
|
||||
{
|
||||
get
|
||||
{
|
||||
if(CurrSashGroup.AreaList[IndexSash] is Splitted)
|
||||
{
|
||||
if (CurrSashGroup.AreaList[IndexSash] is Splitted)
|
||||
{
|
||||
return CurrSashGroup.AreaList[IndexSash];
|
||||
}
|
||||
else
|
||||
@@ -58,49 +81,267 @@ namespace WebWindowTest.Compo
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento per cambiare l'anta su cui è presente la maniglia
|
||||
/// Metodo per avere il numero di decimali da usare nella form-input
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task RaiseChangeHandle(SashDimension sashDim, Sash currSash)
|
||||
public int CssDecimals()
|
||||
{
|
||||
var Args = new DataChangeHandle
|
||||
switch (CurrSashDim.MeasureType)
|
||||
{
|
||||
currSashDimension = sashDim,
|
||||
currItem = currSash,
|
||||
};
|
||||
await EC_ChangeHandle.InvokeAsync(Args);
|
||||
case Json.WindowConst.MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
case Json.WindowConst.MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
case Json.WindowConst.MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento per cambiare l'anta su cui è presente la maniglia
|
||||
/// Metodo per avere il lo step da usare nella form-input
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task RaiseCopyContentSash(Sash currSash, int indexC, int indexM)
|
||||
public double CssStepNumber()
|
||||
{
|
||||
var Args = new DataCopyContentSash
|
||||
switch (CurrSashDim.MeasureType)
|
||||
{
|
||||
currItem = currSash,
|
||||
indexCopy = indexC,
|
||||
indexModify = indexM,
|
||||
case Json.WindowConst.MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
return 0.5;
|
||||
}
|
||||
case Json.WindowConst.MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
case Json.WindowConst.MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
return 0.5;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selezione tipo di apertura anta
|
||||
/// </summary>
|
||||
protected int OpeningTypeIndex
|
||||
{
|
||||
get => CurrSashDim.SelOpeningTypeIndex;
|
||||
set
|
||||
{
|
||||
if (CurrSashDim.SelOpeningTypeIndex != value)
|
||||
{
|
||||
CurrSashDim.SelOpeningTypeIndex = value;
|
||||
_ = EC_UpdateSashDim.InvokeAsync(CurrSashDim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selezione tipo di misura della dimensione dell'anta
|
||||
/// </summary>
|
||||
protected int MeasureTypeIndex
|
||||
{
|
||||
get => CurrSashDim.SelMeasureTypeIndex;
|
||||
set
|
||||
{
|
||||
if (CurrSashDim.SelMeasureTypeIndex != value)
|
||||
{
|
||||
CurrSashDim.SelMeasureTypeIndex = value;
|
||||
_ = EC_UpdateSashDim.InvokeAsync(CurrSashDim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserimento dimensione anta
|
||||
/// </summary>
|
||||
protected double Dimension
|
||||
{
|
||||
get => CurrSashDim.dDimension;
|
||||
set
|
||||
{
|
||||
if (CurrSashDim.dDimension != value)
|
||||
{
|
||||
CurrSashDim.dDimension = (double)Math.Round((decimal)value, CssDecimals());
|
||||
_ = EC_UpdateSashDim.InvokeAsync(CurrSashDim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// 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>
|
||||
/// Metodo per cambiare l'anta su cui è presente la maniglia
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task ChangeHandle()
|
||||
{
|
||||
// Cerco la Sash che si sta considerando nella lista Sash
|
||||
var s = SashList.Where(x => x.GroupId == CurrSashGroup.GroupId).FirstOrDefault();
|
||||
if (s != null)
|
||||
{
|
||||
// Setto la presenza o meno della maniglia per ogni anta
|
||||
foreach (SashDimension item in s.SashList)
|
||||
{
|
||||
if (item.Equals(CurrSashDim))
|
||||
{
|
||||
item.bHasHandle = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.bHasHandle)
|
||||
{
|
||||
switch (item.SelOpeningType)
|
||||
{
|
||||
case Openings.TILTTURN_LEFT:
|
||||
{
|
||||
item.SetOpeningType(Openings.TURNONLY_LEFT);
|
||||
break;
|
||||
}
|
||||
case Openings.TILTTURN_RIGHT:
|
||||
{
|
||||
item.SetOpeningType(Openings.TURNONLY_RIGHT);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
item.bHasHandle = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
CurrSashGroup.RefreshHardwareList();
|
||||
CurrSashGroup.SetFirstHardware();
|
||||
await EC_UpdateSash.InvokeAsync(CurrSashGroup);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copio contenuto anta da indexCopy a IndexModify
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task CopyContentSash(int IndexCopy, int IndexModify)
|
||||
{
|
||||
isOpen = !isOpen;
|
||||
// Anta selezionata
|
||||
Area sashSplitted = CurrSashGroup.AreaList[IndexModify];
|
||||
// Rimuovo riempimento da anta selezionata
|
||||
sashSplitted.AreaList.RemoveAt(0);
|
||||
// Creo la copia dell'anta scelta
|
||||
Area a = CurrSashGroup.AreaList[IndexCopy].AreaList.First().Copy(sashSplitted);
|
||||
// Aggiungo copia all'anta selezionata
|
||||
CurrSashGroup.AreaList[IndexModify].AreaList.Add(a);
|
||||
await EC_UpdateSash.InvokeAsync(CurrSashGroup);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per aggiungere lo split nella singola anta
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task AddSplitToSash()
|
||||
{
|
||||
CurrAnta.AddSplit();
|
||||
await EC_UpdateSash.InvokeAsync(CurrSashGroup);
|
||||
}
|
||||
|
||||
private bool isOpen = false;
|
||||
|
||||
private void ToggleDropdown()
|
||||
{
|
||||
isOpen = !isOpen;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per determinare la visualizzazione dei pulsanti dei joint
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
private string ButtonJointCss(WebWindowTest.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
|
||||
}
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
if (EditMode)
|
||||
mode = ModeView.Edit;
|
||||
else
|
||||
mode = ModeView.View;
|
||||
}
|
||||
private ModeView mode { get; set; } = ModeView.View;
|
||||
private void doEdit(int index)
|
||||
{
|
||||
var args = new DataChangeMode
|
||||
{
|
||||
Edit = true,
|
||||
IndexSashEdit = index,
|
||||
IndexSashClose = -1
|
||||
};
|
||||
await EC_CopyContentSash.InvokeAsync(Args);
|
||||
_ = EC_EditView.InvokeAsync(args);
|
||||
}
|
||||
protected void ClosePopup(int index)
|
||||
{
|
||||
var args = new DataChangeMode
|
||||
{
|
||||
Edit = false,
|
||||
IndexSashEdit = -1,
|
||||
IndexSashClose = index
|
||||
};
|
||||
_ = EC_EditView.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
|
||||
public class DataChangeHandle
|
||||
{
|
||||
public SashDimension currSashDimension { get; set; } = null!;
|
||||
public Sash currItem { get; set; } = null!;
|
||||
|
||||
public class DataChangeMode {
|
||||
public bool Edit { get; set; }
|
||||
public int IndexSashEdit { get; set; }
|
||||
public int IndexSashClose { get; set; }
|
||||
}
|
||||
|
||||
public class DataCopyContentSash
|
||||
{
|
||||
public Sash currItem { get; set; } = null!;
|
||||
|
||||
public int indexCopy { get; set; } = 0;
|
||||
|
||||
public int indexModify { get; set; } = 0;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
|
||||
<div class="col-sm-6 my-2">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<h6 class="fw-bold">Sash</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body py-2">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-start fs-5 mb-2">
|
||||
<div class="px-1">
|
||||
<input class="form-check-input ml-auto" type="checkbox" name="NumTrochetti" checked="@insertQty" @onclick="() => IsCheckedQty()">
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">Qty element</span>
|
||||
@if (insertQty)
|
||||
{
|
||||
@* <input type="number" class="form-control" @bind="@ArcElementQty"> *@
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="number" class="form-control" disabled>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-start fs-5 mb-2">
|
||||
<div class="px-1">
|
||||
@* <input class="form-check-input ml-auto" type="checkbox" name="Estremità" checked="@CurrSashGroup.SashArcElem.bCutEdge" @onclick="() => IsCheckCutEdge()"> *@
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<label class="form-check-label fs-6 text-dark">Taglio estremità</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-start fs-5 mb-2">
|
||||
<div class="px-1">
|
||||
<input class="form-check-input ml-auto" type="checkbox" name="Sezione" checked="@(!insertQty)" @onclick="() => IsCheckedQty()">
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">Section</span>
|
||||
@if (!insertQty)
|
||||
{
|
||||
@* <input type="number" class="form-control" @bind="@ArcSection"> *@
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="number" class="form-control" disabled>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,78 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Runtime.CompilerServices;
|
||||
using WebWindowTest.DTO;
|
||||
using WebWindowTest.Models;
|
||||
|
||||
namespace WebWindowTest.Compo
|
||||
{
|
||||
public partial class AreaSashArcElem
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Sash corrente
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Sash CurrSashGroup { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<Sash> EC_UpdatePreview { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
//protected int ArcElementQty
|
||||
//{
|
||||
// get => CurrSashGroup.SashArcElem.nQty;
|
||||
// set
|
||||
// {
|
||||
// CurrSashGroup.SashArcElem.nQty = value;
|
||||
// _ = EC_UpdatePreview.InvokeAsync(CurrSashGroup);
|
||||
// }
|
||||
//}
|
||||
|
||||
//protected double ArcSection
|
||||
//{
|
||||
// get => CurrSashGroup.SashArcElem.nSection;
|
||||
// set
|
||||
// {
|
||||
// CurrSashGroup.SashArcElem.nSection = value;
|
||||
// _ = EC_UpdatePreview.InvokeAsync(CurrSashGroup);
|
||||
// }
|
||||
//}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void IsCheckedQty()
|
||||
{
|
||||
insertQty = !insertQty;
|
||||
}
|
||||
|
||||
//protected void IsCheckCutEdge()
|
||||
//{
|
||||
// CurrSashGroup.SashArcElem.bCutEdge = !CurrSashGroup.SashArcElem.bCutEdge;
|
||||
// _ = EC_UpdatePreview.InvokeAsync(CurrSashGroup);
|
||||
//}
|
||||
|
||||
protected string IsUsedQty()
|
||||
{
|
||||
if (insertQty)
|
||||
return "form-control";
|
||||
else
|
||||
return "form-control disabled";
|
||||
}
|
||||
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool insertQty = false;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
<div class="card shadow-sm rounded">
|
||||
<div class="card-body py-2">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="col d-flex justify-content-center">
|
||||
<h5>Area split @(CurrSplittedList.Count > 1 ? (CurrSplittedList.IndexOf(CurrSplitted) + 1) : "")</h5>
|
||||
<div class="col-4 d-flex justify-content-left">
|
||||
<h5>Area split @(SplittedList.Count > 1 ? (SplittedList.IndexOf(CurrSplitted) + 1) : "")</h5>
|
||||
</div>
|
||||
<div class="col d-flex justify-content-center">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RaiseAddSash(CurrSplitted)">Add Sash</button>
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RaiseAddSash()">Add Sash</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col d-flex justify-content-center">
|
||||
@for (int j = 0; j < CurrSashList.Count; j++)
|
||||
@for (int j = 0; j < SashList.Count; j++)
|
||||
{
|
||||
int Index = j;
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RaiseCopySash(CurrSplitted,Index)">Copy Sash @(CurrSashList.Count == 1 ? "" : (Index + 1))</button>
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RaiseCopySash(Index)">Copy Sash @(SashList.Count == 1 ? "" : (Index + 1))</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -12,80 +12,56 @@ namespace WebWindowTest.Compo
|
||||
/// Lista delle sash
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public List<Sash> CurrSashList { get; set; } = null;
|
||||
public List<Sash> SashList { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto splitted corrente
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Splitted CurrSplitted { get; set; } = null;
|
||||
public Splitted CurrSplitted { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Lista degli Splitted
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public List<Splitted> CurrSplittedList { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Evento per copiare Sash
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<DataAreaSplit> EC_CopySash { get; set; }
|
||||
public List<Splitted> SplittedList { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Evento per aggiungere Sash
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<DataAreaSplitted> EC_AddSash { get; set; }
|
||||
public EventCallback<Splitted> EC_UpdateSplitted { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento richiesta copia sash
|
||||
/// Metodo per copiare sash
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task RaiseCopySash(Splitted item, int indexCurrSash)
|
||||
private async Task RaiseCopySash(int indexCurrSash)
|
||||
{
|
||||
var Args = new DataAreaSplit
|
||||
{
|
||||
splitted = item,
|
||||
index = indexCurrSash,
|
||||
};
|
||||
await EC_CopySash.InvokeAsync(Args);
|
||||
//Rimuovo contenuto di Splitted e rimuovo area da conteggio gruppi
|
||||
CurrSplitted.AreaList.RemoveAll(i => i != null);
|
||||
// Copio sash
|
||||
Area a = SashList[indexCurrSash].Copy(CurrSplitted);
|
||||
a.SetParentArea(CurrSplitted);
|
||||
// Aggiungo copia a Splitted
|
||||
CurrSplitted.AreaList.Add(a);
|
||||
await EC_UpdateSplitted.InvokeAsync(CurrSplitted);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento richiesta copia sash
|
||||
/// Metodo per aggiungere prima sash
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task RaiseAddSash(Splitted item)
|
||||
private async Task RaiseAddSash()
|
||||
{
|
||||
var Args = new DataAreaSplitted
|
||||
{
|
||||
splitted = item
|
||||
};
|
||||
await EC_AddSash.InvokeAsync(Args);
|
||||
CurrSplitted.AddFirstSash();
|
||||
await EC_UpdateSplitted.InvokeAsync(CurrSplitted);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe per raggruppare oggetti che servono per copiare Sash
|
||||
/// </summary>
|
||||
public class DataAreaSplit
|
||||
{
|
||||
public Splitted splitted { get; set; }
|
||||
public int index { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe per raggruppare oggetti che servono per aggiungere Sash
|
||||
/// </summary>
|
||||
public class DataAreaSplitted
|
||||
{
|
||||
public Splitted splitted { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<div class="card shadow-sm rounded">
|
||||
<div class="card-header bg-light bg-opacity-25">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="px-2">
|
||||
<h5>Arc Element</h5>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-close" @onclick="ReqClose"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body py-2">
|
||||
<div class="row">
|
||||
<AreaFrameArcElem CurrFrame="CurrFrame"
|
||||
EC_UpdatePreview ="UpdatePreview">
|
||||
</AreaFrameArcElem>
|
||||
|
||||
@foreach (var sashGroup in SashList)
|
||||
{
|
||||
<hr />
|
||||
<AreaSashArcElem CurrSashGroup="sashGroup"
|
||||
EC_UpdatePreview="UpdatePreviewSash">
|
||||
</AreaSashArcElem>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,60 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using WebWindowTest.DTO;
|
||||
using WebWindowTest.Models;
|
||||
|
||||
namespace WebWindowTest.Compo
|
||||
{
|
||||
public partial class CardArcElement
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Frame corrente
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Frame CurrFrame { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Lista sash group
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public List<Sash> SashList { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DataUpdateFrame> EC_UpdatePreview { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_ReqClose { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
private async Task UpdatePreview()
|
||||
{
|
||||
var args = new DataUpdateFrame
|
||||
{
|
||||
currFrame = CurrFrame
|
||||
};
|
||||
await EC_UpdatePreview.InvokeAsync(args);
|
||||
}
|
||||
|
||||
private async Task UpdatePreviewSash(Sash CurrSashGRoup)
|
||||
{
|
||||
var currRec = SashList.First(x => x.GroupId == CurrSashGRoup.GroupId);
|
||||
if (currRec != null)
|
||||
{
|
||||
currRec = CurrSashGRoup;
|
||||
var args = new DataUpdateFrame
|
||||
{
|
||||
currFrame = CurrFrame
|
||||
};
|
||||
await EC_UpdatePreview.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
|
||||
private void ReqClose()
|
||||
{
|
||||
_ = EC_ReqClose.InvokeAsync(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
<div class="card shadow-sm rounded mb-4">
|
||||
<div class="card-header bg-light bg-opacity-25">
|
||||
<div class="d-flex justify-content-between align-middle">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="px-2">
|
||||
<h5>Fill @(CurrIndex + 1)</h5>
|
||||
</div>
|
||||
@@ -11,8 +11,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body py-2">
|
||||
<div class="d-flex justify-content-between align-center my-2">
|
||||
<div class="col d-flex justify-content-center">
|
||||
<div class="d-flex justify-content-between align-items-center my-2">
|
||||
<div class="col d-flex justify-content-left">
|
||||
<h6>Select only current fill</h6>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
@@ -26,33 +26,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="col d-flex justify-content-center">
|
||||
<h6 class="text-center">Selected all fill</h6>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllFill(WebWindowTest.Json.WindowConst.FillTypes.GLASS)">All glass</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllFill(WebWindowTest.Json.WindowConst.FillTypes.WOOD)">All wood</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@foreach (var currSplitted in SplittedList)
|
||||
{
|
||||
@if (currSplitted.AreaList.First().Equals(CurrItem))
|
||||
{
|
||||
<AreaSplit CurrSashList="SashList"
|
||||
CurrSplittedList="SplittedList"
|
||||
CurrSplitted="currSplitted"
|
||||
EC_AddSash="AddSash"
|
||||
EC_CopySash="CopySash">
|
||||
</AreaSplit>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,31 +18,13 @@ namespace WebWindowTest.Compo
|
||||
/// Fill corrente rispetto alla lista fill
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Fill CurrItem { get; set; } = null!;
|
||||
public Fill CurrFill { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Evento per cambiare tutti i fill
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<FillTypes> EC_ChangeAllType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per cambiare solo il fill corrente
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<FillTypes> EC_ChangeType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per copiare sash
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<DataAreaSplit> EC_CopySash { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per aggiungere sash
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<DataAreaSplitted> EC_AddSash { get; set; }
|
||||
public EventCallback<Fill> EC_UpdateFill { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per tornare nella pagine Tree
|
||||
@@ -50,67 +32,19 @@ namespace WebWindowTest.Compo
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_ReqClose { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Lista dei Fill
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public List<Fill> FillList { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Lista delle sash
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public List<Sash> SashList { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Lista degli Splitted
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public List<Splitted> SplittedList { get; set; } = null!;
|
||||
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento per cambiare tutti i Fill
|
||||
/// </summary>
|
||||
/// <param name="reqFillType"> tipo di fill richiesto </param>
|
||||
/// <returns></returns>
|
||||
protected async Task ChangeAllFill(FillTypes reqFillType)
|
||||
{
|
||||
await EC_ChangeAllType.InvokeAsync(reqFillType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento per cambiare solo il Fill corrente
|
||||
/// Metodo per cambiare solo il Fill corrente
|
||||
/// </summary>
|
||||
/// <param name="reqFillType"> tipo di fill richiesto </param>
|
||||
/// <returns></returns>
|
||||
protected async Task ChangeOneFill(FillTypes reqFillType)
|
||||
{
|
||||
await EC_ChangeType.InvokeAsync(reqFillType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento per copiare sash
|
||||
/// </summary>
|
||||
/// <param name="Args"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task CopySash(DataAreaSplit Args)
|
||||
{
|
||||
await EC_CopySash.InvokeAsync(Args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento per aggiungere sash
|
||||
/// </summary>
|
||||
/// <param name="Args"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task AddSash(DataAreaSplitted Args)
|
||||
{
|
||||
await EC_AddSash.InvokeAsync(Args);
|
||||
CurrFill.SetFillType(reqFillType);
|
||||
await EC_UpdateFill.InvokeAsync(CurrFill);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
@@ -118,7 +52,7 @@ namespace WebWindowTest.Compo
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento per tornare alla pagina Tree
|
||||
/// Metodo per tornare alla pagina Tree
|
||||
/// </summary>
|
||||
private void ReqClose()
|
||||
{
|
||||
@@ -131,7 +65,7 @@ namespace WebWindowTest.Compo
|
||||
/// <returns></returns>
|
||||
private string buttonFillCss(FillTypes reqFillTypes)
|
||||
{
|
||||
return (FillList.ElementAt(CurrIndex).SelFillType == reqFillTypes) ? "btn btn-secondary btn-sm" : "btn btn-outline-secondary btn-sm";
|
||||
return (CurrFill.SelFillType == reqFillTypes) ? "btn btn-secondary btn-sm" : "btn btn-outline-secondary btn-sm";
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
@using WebWindowTest.Models
|
||||
@using static WebWindowTest.LayoutConst
|
||||
@using static WebWindowTest.LayoutConst
|
||||
|
||||
<div class="card shadow-sm rounded mb-4">
|
||||
<div class="card-header bg-light bg-opacity-25">
|
||||
@@ -14,81 +13,69 @@
|
||||
</div>
|
||||
<div class="card-body py-2">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="input-group my-2">
|
||||
<label class="input-group-text">Shape</label>
|
||||
<select class="form-select" @bind="@SelShapeIndex">
|
||||
@foreach (var i in FrameWindow.ShapeList)
|
||||
{
|
||||
<option value="@(i.Id)">@(i.Name)</option>
|
||||
}
|
||||
@* <option value="0">Rectangle</option>
|
||||
<option value="1">Right Chamfer</option>
|
||||
<option value="2">Left Chamfer</option>
|
||||
<option value="3">Double Chamfer</option>
|
||||
<option value="4">Arc</option>
|
||||
<option value="5">Arc Full</option>
|
||||
<option value="6">Double Arc</option>
|
||||
<option value="7">Triangle</option> *@
|
||||
</select>
|
||||
<span class="input-group-text">Tipology</span>
|
||||
<input type="text" readonly class="form-control" value="@(CurrFrameWindow.ShapeList.ElementAt(SelShapeIndex - 1))">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="d-flex justify-content-start align-items-center">
|
||||
<h6 class="fw-bold">Dimension</h6>
|
||||
</div>
|
||||
@foreach (FrameDimension dimension in FrameWindow.DimensionList)
|
||||
@foreach (FrameDimension dimension in CurrFrameWindow.DimensionList)
|
||||
{
|
||||
<EditDimensions CurrRec="dimension" EC_Update="UpdateDim"></EditDimensions>
|
||||
<EditFrameDimensions CurrRec="dimension" EC_Update="UpdateDim"></EditFrameDimensions>
|
||||
}
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="d-flex justify-content-start align-items-center">
|
||||
<h6 class="fw-bold">Threshold</h6>
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text">Tipology</label>
|
||||
<select class="form-select">
|
||||
<option value="0">Soglia</option>
|
||||
<option value="1">Sgocciolatoio</option>
|
||||
</select>
|
||||
<span class="input-group-text">Tipology</span>
|
||||
<input type="text" readonly class="form-control" value="@(CurrFrameWindow.ThresholdList.FirstOrDefault(x => x.Type == SelThreshold).Name)">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="row justify-content-between align-items-center">
|
||||
<div class="col d-flex justify-content-start align-items-center">
|
||||
<h6 class="fw-bold">Joints</h6>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllJoints(WebWindowTest.Json.WindowConst.Joints.ANGLED, FrameWindow)">Angled</button>
|
||||
<button class="@ButtonJointCss(Json.WindowConst.Joints.ANGLED)" @onclick="() => ChangeAllJoints(Json.WindowConst.Joints.ANGLED, CurrFrameWindow)">Angled</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllJoints(WebWindowTest.Json.WindowConst.Joints.FULL_H, FrameWindow)">Horizontal</button>
|
||||
<button class="@ButtonJointCss(Json.WindowConst.Joints.FULL_H)" @onclick="() => ChangeAllJoints(Json.WindowConst.Joints.FULL_H, CurrFrameWindow)">Horizontal</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllJoints(WebWindowTest.Json.WindowConst.Joints.FULL_V, FrameWindow)">Vertical</button>
|
||||
<button class="@ButtonJointCss(Json.WindowConst.Joints.FULL_V)" @onclick="() => ChangeAllJoints(Json.WindowConst.Joints.FULL_V, CurrFrameWindow)">Vertical</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@foreach (Joint joint in FrameWindow.JointList)
|
||||
@foreach (Joint joint in CurrFrameWindow.JointList)
|
||||
{
|
||||
@* <div class="input-group mb-2">
|
||||
<span class="input-group-text">@((PositionJoints)(joint.nIndex - 1))</span>
|
||||
<input type="text" readonly class="form-control" value="@(joint.SelJointType.ToString().Replace("_", " "))">
|
||||
</div> *@
|
||||
<EditJoint CurrRec="joint" EC_Update="UpdateJoint"></EditJoint>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
@if (SashList.Count == 0)
|
||||
{
|
||||
<div class="d-flex justify-content-start align-items-center">
|
||||
@@ -97,7 +84,7 @@
|
||||
<div class="row">
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">Quantity</span>
|
||||
<input type="number" class="form-control" @bind="@FrameWindow.BottomRailQty">
|
||||
<input type="number" readonly class="form-control" value="@FrameBottomRailQty">
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -105,13 +92,3 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (!(FrameWindow.AreaList[0] is Split) || (SashList.Count == 0 && SplitList.Count == 0))
|
||||
{
|
||||
<AreaFrame CurrFrameWindow="FrameWindow"
|
||||
CurrSashList="SashList"
|
||||
CurrSplitList="SplitList"
|
||||
EC_AddSash="AddSash"
|
||||
EC_AddSplit="AddSplit">
|
||||
</AreaFrame>
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Egw.Window.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using WebWindowTest.Models;
|
||||
|
||||
@@ -7,24 +8,6 @@ namespace WebWindowTest.Compo
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Evento per aggiungere sash
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_AddSash { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per aggiungere split
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_AddSplit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per cambiare tutti i Joints
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<DataChangeJoints> EC_ChangeAllJoints { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per tornare nella pagine Tree
|
||||
/// </summary>
|
||||
@@ -35,58 +18,111 @@ namespace WebWindowTest.Compo
|
||||
/// Evento per richiedere reset dizionario Shape
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_ReqResetDictShape { get; set; }
|
||||
public EventCallback<DataUpdateRes> EC_ReqResetDict { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per aggiornare info frame (es cambaire tutti i Joints)
|
||||
/// Evento per richiedere opzioni hardware
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<Frame> EC_UpdateFrame { get; set; }
|
||||
|
||||
public EventCallback<Frame> EC_ReqOptionHw { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per richiesta calcolo Shape
|
||||
/// Evento per richiesta calcolo preview
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<Frame> EC_UpdateShape { get; set; }
|
||||
public EventCallback<DataUpdateFrame> EC_UpdateFrame { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Frame corrente
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Frame FrameWindow { get; set; } = null!;
|
||||
[CascadingParameter(Name = "CurrFrameWindow")]
|
||||
public Frame CurrFrameWindow { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Lista di sash
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
[CascadingParameter(Name = "SashList")]
|
||||
public List<Sash> SashList { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Lista di split
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
[CascadingParameter(Name = "SplitList")]
|
||||
public List<Split> SplitList { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per selezionare shape
|
||||
/// </summary>
|
||||
protected int SelShapeIndex
|
||||
{
|
||||
get => FrameWindow.SelShapeIndex;
|
||||
get => CurrFrameWindow.SelShapeIndex;
|
||||
set
|
||||
{
|
||||
if (FrameWindow.SelShapeIndex != value)
|
||||
if (CurrFrameWindow.SelShapeIndex != value)
|
||||
{
|
||||
CurrFrameWindow.SelShapeIndex = value;
|
||||
// richiesta reset dict shape
|
||||
_ = EC_ReqResetDictShape.InvokeAsync(true);
|
||||
FrameWindow.SelShapeIndex = value;
|
||||
_ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetDictShape});
|
||||
foreach(var s in SashList)
|
||||
{
|
||||
s.SelHardwareFromId = "000000";
|
||||
}
|
||||
_ = EC_UpdateFrame.InvokeAsync(FrameWindow);
|
||||
_ = EC_UpdateShape.InvokeAsync(FrameWindow);
|
||||
var args = new DataUpdateFrame()
|
||||
{
|
||||
currFrame = CurrFrameWindow,
|
||||
svgNoHw = true
|
||||
};
|
||||
_ = EC_UpdateFrame.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per selezionare threshold
|
||||
/// </summary>
|
||||
protected int SelThreshold
|
||||
{
|
||||
get => CurrFrameWindow.SelThresholdFromType;
|
||||
set
|
||||
{
|
||||
if (CurrFrameWindow.SelThresholdFromType != value)
|
||||
{
|
||||
CurrFrameWindow.SelThresholdFromType = value;
|
||||
var args = new DataUpdateFrame()
|
||||
{
|
||||
currFrame = CurrFrameWindow,
|
||||
svgNoHw = false
|
||||
};
|
||||
_ = EC_UpdateFrame.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selezione quantità bottom rail
|
||||
/// </summary>
|
||||
protected int FrameBottomRailQty
|
||||
{
|
||||
get => CurrFrameWindow.BottomRailQty;
|
||||
set
|
||||
{
|
||||
if (CurrFrameWindow.BottomRailQty != value)
|
||||
{
|
||||
CurrFrameWindow.BottomRailQty = value;
|
||||
if (CurrFrameWindow.BottomRailQty > 0)
|
||||
CurrFrameWindow.SetBottomRail(true);
|
||||
else
|
||||
CurrFrameWindow.SetBottomRail(false);
|
||||
var args = new DataUpdateFrame()
|
||||
{
|
||||
currFrame = CurrFrameWindow,
|
||||
svgNoHw = false
|
||||
};
|
||||
_ = EC_UpdateFrame.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,36 +132,24 @@ namespace WebWindowTest.Compo
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento richiesta aggiunta sash
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task AddSash()
|
||||
{
|
||||
//await EC_UpdateShape.InvokeAsync(FrameWindow);
|
||||
await EC_AddSash.InvokeAsync(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento richiesta aggiunta window
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task AddSplit()
|
||||
{
|
||||
await EC_AddSplit.InvokeAsync(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento richiesta copia sash
|
||||
/// Metodo per cambiare tutti i joint
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task ChangeAllJoints(Json.WindowConst.Joints JointType, Area a)
|
||||
{
|
||||
var Args = new DataChangeJoints
|
||||
if (a is Frame)
|
||||
{
|
||||
currJointType = JointType,
|
||||
currArea = a,
|
||||
foreach (Joint joint in CurrFrameWindow.JointList)
|
||||
{
|
||||
joint.SetSelJointType(JointType);
|
||||
}
|
||||
}
|
||||
var args = new DataUpdateFrame()
|
||||
{
|
||||
currFrame = CurrFrameWindow,
|
||||
svgNoHw = false
|
||||
};
|
||||
await EC_ChangeAllJoints.InvokeAsync(Args);
|
||||
await EC_UpdateFrame.InvokeAsync(args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -143,45 +167,70 @@ namespace WebWindowTest.Compo
|
||||
private async Task UpdateDim(FrameDimension updRec)
|
||||
{
|
||||
// cerco il record
|
||||
var currRec = FrameWindow.DimensionList.FirstOrDefault(x => x.ParentFrame == updRec.ParentFrame && x.nIndex == updRec.nIndex);
|
||||
var currRec = CurrFrameWindow.DimensionList.FirstOrDefault(x => x.ParentFrame == updRec.ParentFrame && x.nIndex == updRec.nIndex);
|
||||
// lo aggiorno
|
||||
if (updRec != null)
|
||||
{
|
||||
currRec = updRec;
|
||||
await EC_UpdateShape.InvokeAsync(FrameWindow);
|
||||
await EC_UpdateFrame.InvokeAsync(FrameWindow);
|
||||
var args = new DataUpdateFrame()
|
||||
{
|
||||
currFrame = CurrFrameWindow,
|
||||
svgNoHw = true
|
||||
};
|
||||
await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetDictShape });
|
||||
await EC_UpdateFrame.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Report aggiornamento joint
|
||||
/// Aggiornamento joint
|
||||
/// </summary>
|
||||
/// <param name="updRec"></param>
|
||||
/// <returns></returns>
|
||||
private async Task UpdateJoint(Joint updRec)
|
||||
{
|
||||
// cerco il record
|
||||
var currRec = FrameWindow.JointList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex);
|
||||
var currRec = CurrFrameWindow.JointList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex);
|
||||
// lo aggiorno
|
||||
if (updRec != null)
|
||||
{
|
||||
currRec = updRec;
|
||||
await EC_UpdateFrame.InvokeAsync(FrameWindow);
|
||||
var args = new DataUpdateFrame()
|
||||
{
|
||||
currFrame = CurrFrameWindow,
|
||||
svgNoHw = false
|
||||
};
|
||||
await EC_UpdateFrame.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per la visualizzazione dei pulsanti joint
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
private string ButtonJointCss(WebWindowTest.Json.WindowConst.Joints type)
|
||||
{
|
||||
foreach (var item in CurrFrameWindow.JointList)
|
||||
{
|
||||
if (!item.SelJointType.Equals(type))
|
||||
return "btn btn-outline-secondary btn-sm";
|
||||
}
|
||||
return "btn btn-secondary btn-sm";
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe per raggruppare oggetti che servono per copiare Sash
|
||||
/// Classe per raggruppare oggetti che servono per aggiornare frame
|
||||
/// </summary>
|
||||
public class DataChangeJoints
|
||||
public class DataUpdateFrame
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public Area currArea { get; set; } = null!;
|
||||
public Json.WindowConst.Joints currJointType { get; set; }
|
||||
public Frame currFrame { get; set; } = null!;
|
||||
public bool svgNoHw { get; set; } = false;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
@@ -5,12 +5,7 @@
|
||||
<div class="card-header bg-light bg-opacity-25">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="px-2">
|
||||
<h5>Sash group @(SashList.Count > 1 ? (CurrIndex + 1) : "")</h5>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RemoveArea(CurrItem)">Remove sash group</button>
|
||||
</div>
|
||||
<h5>Sash group @(SashList.Count > 1 ? (SashList.IndexOf(CurrSashGroup) + 1) : "")</h5>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-close" @onclick="ReqClose"></button>
|
||||
@@ -19,131 +14,105 @@
|
||||
</div>
|
||||
<div class="card-body py-2">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">Qty sash</span>
|
||||
<input type="number" class="form-control" @bind="@CurrItem.nSashQty">
|
||||
<input type="number" readonly class="form-control" value="@SashQty">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text">Tipology</label>
|
||||
<select class="form-select" @bind="@CurrItem.SelOrientationSashTypeIndex">
|
||||
@foreach (var orientationSash in CurrItem.OrientationSashTypeList)
|
||||
{
|
||||
<option value="@(orientationSash.Id)">@(orientationSash.Name)</option>
|
||||
}
|
||||
@* <option value="0">Vertical</option>
|
||||
<option value="1">Horizontal</option> *@
|
||||
</select>
|
||||
<span class="input-group-text">Tipology</span>
|
||||
<input type="text" readonly class="form-control" value="@(CurrSashGroup.OrientationSashTypeList.FirstOrDefault(x => x.Id == OrientationSashTypeIndex).Name)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">Qty bottom rail</span>
|
||||
<input type="number" class="form-control" @bind="@CurrItem.SashBottomRailQty">
|
||||
<input type="number" readonly class="form-control" value="@SashBottomRailQty">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="row justify-content-between align-items-center">
|
||||
<div class="col d-flex justify-content-start align-items-center">
|
||||
<h6 class="fw-bold">Hardware</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text">Family</label>
|
||||
<select class="form-select" @bind="@CurrItem.SelFamilyHardware">
|
||||
@if (Sash.s_FamilyHardwareList == null || Sash.s_FamilyHardwareList.Count == 0)
|
||||
{
|
||||
<option value="000000">CUSTOM</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var familyHw in Sash.s_FamilyHardwareList)
|
||||
{
|
||||
<option value="@familyHw">@familyHw</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<span class="input-group-text">Family</span>
|
||||
<input type="text" readonly class="form-control" value="@FamilyHardware">
|
||||
</div>
|
||||
@if (string.IsNullOrEmpty(CurrItem.SashShape))
|
||||
{
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text">Type</label>
|
||||
<select class="form-select">
|
||||
<option value="000000">Custom HW</option>
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text">Type</label>
|
||||
<select class="form-select" @bind="SelHwType">
|
||||
<option value="000000">Custom HW</option>
|
||||
@foreach (var hlItem in CurrItem.HardwareList)
|
||||
{
|
||||
<option value="@hlItem.Id">@hlItem.Description</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<AreaHwOption CurrSash="CurrItem"
|
||||
EC_UpdateHwOptCombo="UpdateOptCombo"
|
||||
EC_UpdateHwOptText="UpdateOptText"
|
||||
EC_FirstHwOptionList="FirstHwOptionList">
|
||||
</AreaHwOption>
|
||||
}
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="row justify-content-between align-items-center">
|
||||
<div class="col d-flex justify-content-start align-items-center">
|
||||
<h6 class="fw-bold">Joints</h6>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllJoints(WebWindowTest.Json.WindowConst.Joints.ANGLED, CurrItem)">Angled</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllJoints(WebWindowTest.Json.WindowConst.Joints.FULL_H, CurrItem)">Horizontal</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllJoints(WebWindowTest.Json.WindowConst.Joints.FULL_V, CurrItem)">Vertical</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">Type</span>
|
||||
<input type="text" readonly class="form-control" value="@SelHwType">
|
||||
</div>
|
||||
@foreach (Joint joint in CurrItem.JointList)
|
||||
{
|
||||
<EditJoint CurrRec="joint" EC_Update="UpdateJoint"></EditJoint>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card shadow-sm rounded mb-4">
|
||||
<div class="card-body py-2">
|
||||
<div class="row">
|
||||
@for (int i = 0; i < CurrItem.SashList.Count; i++)
|
||||
{
|
||||
<AreaSash CurrSashDim="CurrItem.SashList[i]"
|
||||
CurrSashGroup="CurrItem"
|
||||
IndexSash="i"
|
||||
EC_ChangeHandle="ChangeHandle"
|
||||
EC_CopyContentSash="CopyContentSash">
|
||||
</AreaSash>
|
||||
}
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<AreaHwOption EC_UpdateHwOpt="UpdateOpt"
|
||||
EC_FirstHwOptionList="FirstHwOptionList">
|
||||
</AreaHwOption>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="card shadow-sm rounded mb-4">
|
||||
<div class="card-body py-2">
|
||||
<div class="d-flex justify-content-end">
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-outline-secondary dropdown-toggle btn-sm" type="button" @onclick="ToggleDropdown">
|
||||
Measure
|
||||
</button>
|
||||
<ul class="dropdown-menu @(isOpen ? "show" : "")" style="min-width:5rem; max-width:10rem">
|
||||
<li>
|
||||
<button class="dropdown-item" @onclick="() => SetMeasureType(MeasureTypes.ABSOLUTE)">
|
||||
Absolute
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button class="dropdown-item" @onclick="() => SetMeasureType(MeasureTypes.PROPORTIONAL)">
|
||||
Proportional
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button class="dropdown-item" @onclick="() => SetMeasureType(MeasureTypes.PERCENTAGE)">
|
||||
Percentage
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@for (int i = 0; i < CurrSashGroup.SashList.Count; i++)
|
||||
{
|
||||
@if (editMode && currSashDimEdit.Contains(i))
|
||||
{
|
||||
<div class="col-12 my-2">
|
||||
<AreaSash CurrSashDim="CurrSashGroup.SashList[i]"
|
||||
IndexSash="i"
|
||||
EditMode="editMode"
|
||||
EC_UpdateSash="UpdateSash"
|
||||
EC_UpdateSashDim="UpdateSashDimension"
|
||||
EC_EditView="EditView">
|
||||
</AreaSash>
|
||||
</div>
|
||||
}
|
||||
else if(currSashDimEdit.Count == 0)
|
||||
{
|
||||
<AreaSash CurrSashDim="CurrSashGroup.SashList[i]"
|
||||
IndexSash="i"
|
||||
EditMode="editMode"
|
||||
EC_UpdateSash="UpdateSash"
|
||||
EC_UpdateSashDim="UpdateSashDimension"
|
||||
EC_EditView="EditView">
|
||||
</AreaSash>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using WebWindowTest.Models;
|
||||
using static WebWindowTest.Json.WindowConst;
|
||||
using static WebWindowTest.LayoutConst;
|
||||
|
||||
namespace WebWindowTest.Compo
|
||||
{
|
||||
@@ -8,41 +9,17 @@ namespace WebWindowTest.Compo
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Indice della sash corrente rispetto alla lista sash
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public int CurrIndex { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Sash corrente rispetto alla lista Sash
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Sash CurrItem { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Evento per cambiare tutti i Joints
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<DataChangeJoints> EC_ChangeAllJoints { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per cambiare l'anta su cui è presente la maniglia
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<DataChangeHandle> EC_ChangeHandle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per cambiare l'anta su cui è presente la maniglia
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<DataCopyContentSash> EC_CopyContentSash { get; set; }
|
||||
[CascadingParameter(Name = "CurrSashGroup")]
|
||||
public Sash CurrSashGroup { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Evento per cambiare tutti i fill
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<Area> EC_RemoveArea { get; set; }
|
||||
public EventCallback<DataUpdateFrame> EC_UpdateFrame { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per tornare nella pagine Tree
|
||||
@@ -54,102 +31,228 @@ namespace WebWindowTest.Compo
|
||||
/// Evento per richiedere reset dizionario Shape
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_ReqResetDictShape { get; set; }
|
||||
public EventCallback<DataUpdateRes> EC_ReqResetDict { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per cambiare tutti i Joints
|
||||
/// Evento per richiedere opzioni hardware
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<Sash> EC_UpdateSash { get; set; }
|
||||
public EventCallback<Sash> EC_ReqOptionHw { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per segnalare cambio hw e richiesta calcolo
|
||||
/// Evento per richiedere per la prima volta opzioni hardware
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<Sash> EC_UpdateSashHardware { get; set; }
|
||||
public EventCallback<Sash> EC_ReqFirstOptionHw { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per richiedere la prima volta le opzioni hardware
|
||||
/// Evento per segnalare aggiornamento
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<int> EC_CallFirstHwOpt { get; set; }
|
||||
public EventCallback<DataUpdateSash> EC_UpdateSashGroup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Lista di sash
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
[CascadingParameter(Name = "SashList")]
|
||||
public List<Sash> SashList { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Frame corrente
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Frame FrameWindow { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Selezione hardware
|
||||
/// Selezione quantità di ante
|
||||
/// </summary>
|
||||
protected string SelHwType
|
||||
protected int SashQty
|
||||
{
|
||||
get => CurrItem.SelHardwareFromId;
|
||||
get => CurrSashGroup.nSashQty;
|
||||
set
|
||||
{
|
||||
if (CurrItem.SelHardwareFromId != value)
|
||||
if (CurrSashGroup.nSashQty != value)
|
||||
{
|
||||
CurrItem.SelHardwareFromId = value;
|
||||
_ = EC_UpdateSashHardware.InvokeAsync(CurrItem);
|
||||
CurrSashGroup.nSashQty = value;
|
||||
var args = new DataUpdateSash()
|
||||
{
|
||||
currSash = CurrSashGroup,
|
||||
svgNoHw = true
|
||||
};
|
||||
_ = EC_UpdateSashGroup.InvokeAsync(args);
|
||||
_ = EC_ReqOptionHw.InvokeAsync(CurrSashGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selezione quantità bottom rail
|
||||
/// </summary>
|
||||
protected int SashBottomRailQty
|
||||
{
|
||||
get => CurrSashGroup.SashBottomRailQty;
|
||||
set
|
||||
{
|
||||
if (CurrSashGroup.SashBottomRailQty != value)
|
||||
{
|
||||
CurrSashGroup.SashBottomRailQty = value;
|
||||
if (CurrSashGroup.SashBottomRailQty > 0)
|
||||
CurrSashGroup.SetSashBottomRail(true);
|
||||
else
|
||||
CurrSashGroup.SetSashBottomRail(false);
|
||||
var args = new DataUpdateSash()
|
||||
{
|
||||
currSash = CurrSashGroup
|
||||
};
|
||||
_ = EC_UpdateSashGroup.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selezione tipo di orientamento della sash
|
||||
/// </summary>
|
||||
protected int OrientationSashTypeIndex
|
||||
{
|
||||
get => CurrSashGroup.SelOrientationSashTypeIndex;
|
||||
set
|
||||
{
|
||||
if (CurrSashGroup.SelOrientationSashTypeIndex != value)
|
||||
{
|
||||
CurrSashGroup.SelOrientationSashTypeIndex = value;
|
||||
var args = new DataUpdateSash()
|
||||
{
|
||||
currSash = CurrSashGroup
|
||||
};
|
||||
_ = EC_UpdateSashGroup.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Selezione famiglia hardware
|
||||
/// </summary>
|
||||
protected string FamilyHardware
|
||||
{
|
||||
get => CurrSashGroup.SelFamilyHardware;
|
||||
set
|
||||
{
|
||||
if (CurrSashGroup.SelFamilyHardware != value)
|
||||
{
|
||||
CurrSashGroup.SelFamilyHardware = value;
|
||||
var args = new DataUpdateSash()
|
||||
{
|
||||
currSash = CurrSashGroup,
|
||||
svgNoHw = true
|
||||
};
|
||||
_ = EC_UpdateSashGroup.InvokeAsync(args);
|
||||
_ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = DataAction.ResetHwOpt});
|
||||
_ = EC_ReqOptionHw.InvokeAsync(CurrSashGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected string SelHwType
|
||||
{
|
||||
get => CurrSashGroup.GetHardwareDescription;
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento per rimuovere area
|
||||
/// Metodo per rimuovere area
|
||||
/// </summary>
|
||||
/// <param name="currArea"> area da rimuovere </param>
|
||||
/// <returns></returns>
|
||||
protected async Task RemoveArea(Area currArea)
|
||||
protected async Task RemoveArea()
|
||||
{
|
||||
CurrSashGroup.Remove();
|
||||
var args = new DataUpdateFrame()
|
||||
{
|
||||
currFrame = FrameWindow
|
||||
};
|
||||
// richiesta reset dict shape
|
||||
await EC_ReqResetDictShape.InvokeAsync(true);
|
||||
await EC_RemoveArea.InvokeAsync(currArea);
|
||||
await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req=DataAction.ResetDictShape});
|
||||
await EC_UpdateFrame.InvokeAsync(args);
|
||||
await EC_ReqClose.InvokeAsync(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per scegliere tipo di misura
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task SetMeasureType(MeasureTypes type)
|
||||
{
|
||||
isOpen = !isOpen;
|
||||
for(int i = 0; i < CurrSashGroup.SashList.Count; i++)
|
||||
{
|
||||
CurrSashGroup.SashList.ElementAt(i).SetSelMeasureType(type, i);
|
||||
}
|
||||
var args = new DataUpdateSash
|
||||
{
|
||||
currSash = CurrSashGroup,
|
||||
noSvg = true
|
||||
};
|
||||
await EC_UpdateSashGroup.InvokeAsync(args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per aggiornare la sash dimension
|
||||
/// </summary>
|
||||
/// <param name="updateSD"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task UpdateSashDimension(SashDimension updateSD)
|
||||
{
|
||||
var currRec = CurrSashGroup.SashList.First(x => x.nSashId == updateSD.nSashId);
|
||||
if(currRec != null)
|
||||
{
|
||||
currRec = updateSD;
|
||||
var args = new DataUpdateSash
|
||||
{
|
||||
currSash = CurrSashGroup
|
||||
};
|
||||
await EC_UpdateSashGroup.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per aggiornare sash
|
||||
/// </summary>
|
||||
/// <param name="updateS"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task UpdateSash(Sash updateS)
|
||||
{
|
||||
if (updateS != null)
|
||||
{
|
||||
CurrSashGroup = updateS;
|
||||
var args = new DataUpdateSash
|
||||
{
|
||||
currSash = CurrSashGroup
|
||||
};
|
||||
await EC_UpdateSashGroup.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento richiesta per cambiare tutti i Joint
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task ChangeAllJoints(Json.WindowConst.Joints JointType, Area a)
|
||||
private bool editMode = false;
|
||||
private List<int> currSashDimEdit = new List<int>();
|
||||
private void EditView(DataChangeMode args)
|
||||
{
|
||||
var Args = new DataChangeJoints
|
||||
{
|
||||
currJointType = JointType,
|
||||
currArea = a,
|
||||
};
|
||||
await EC_ChangeAllJoints.InvokeAsync(Args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento per cambiare l'anta su cui è presente la maniglia
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task ChangeHandle(DataChangeHandle Args)
|
||||
{
|
||||
await EC_ChangeHandle.InvokeAsync(Args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento per cambiare l'anta su cui è presente la maniglia
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task CopyContentSash(DataCopyContentSash Args)
|
||||
{
|
||||
await EC_CopyContentSash.InvokeAsync(Args);
|
||||
editMode = args.Edit;
|
||||
if(args.IndexSashEdit != -1)
|
||||
currSashDimEdit.Add(args.IndexSashEdit);
|
||||
if (args.IndexSashClose != -1)
|
||||
currSashDimEdit.Remove(args.IndexSashClose);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -161,53 +264,45 @@ namespace WebWindowTest.Compo
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Report aggiornamento joint
|
||||
/// Aggiornamento opzioni hardware
|
||||
/// </summary>
|
||||
/// <param name="updRec"></param>
|
||||
/// <returns></returns>
|
||||
private async Task UpdateJoint(Joint updRec)
|
||||
private async Task UpdateOpt(DataUpdateHwOption argsHw)
|
||||
{
|
||||
// cerco il record
|
||||
var currRec = CurrItem.JointList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex);
|
||||
// lo aggiorno
|
||||
if (updRec != null)
|
||||
AGBOptionCombo AGBOptCombo = argsHw.AGBOptCombo;
|
||||
AGBOptionText AGBOptText = argsHw.AGBOptText;
|
||||
if (AGBOptCombo != null)
|
||||
{
|
||||
currRec = updRec;
|
||||
await EC_UpdateSash.InvokeAsync(CurrItem);
|
||||
// cerco il record
|
||||
var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == AGBOptCombo.sName && x.sDescription == AGBOptCombo.sDescription);
|
||||
// lo aggiorno
|
||||
if (AGBOptCombo != null)
|
||||
{
|
||||
currRec = AGBOptCombo;
|
||||
var args = new DataUpdateSash
|
||||
{
|
||||
currSash = CurrSashGroup
|
||||
};
|
||||
await EC_UpdateSashGroup.InvokeAsync(args);
|
||||
await EC_ReqOptionHw.InvokeAsync(CurrSashGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Report aggiornamento Option Combo
|
||||
/// </summary>
|
||||
/// <param name="updRec"></param>
|
||||
/// <returns></returns>
|
||||
private async Task UpdateOptCombo(AGBOptionCombo updRec)
|
||||
{
|
||||
// cerco il record
|
||||
var currRec = CurrItem.HwOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription);
|
||||
// lo aggiorno
|
||||
if (updRec != null)
|
||||
else
|
||||
{
|
||||
currRec = updRec;
|
||||
await EC_UpdateSashHardware.InvokeAsync(CurrItem);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Report aggiornamento Option Text
|
||||
/// </summary>
|
||||
/// <param name="updRec"></param>
|
||||
/// <returns></returns>
|
||||
private async Task UpdateOptText(AGBOptionText updRec)
|
||||
{
|
||||
// cerco il record
|
||||
var currRec = CurrItem.HwOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription);
|
||||
// lo aggiorno
|
||||
if (updRec != null)
|
||||
{
|
||||
currRec = updRec;
|
||||
await EC_UpdateSashHardware.InvokeAsync(CurrItem);
|
||||
// cerco il record
|
||||
var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == AGBOptText.sName && x.sDescription == AGBOptText.sDescription);
|
||||
// lo aggiorno
|
||||
if (AGBOptText != null)
|
||||
{
|
||||
currRec = AGBOptText;
|
||||
var args = new DataUpdateSash
|
||||
{
|
||||
currSash = CurrSashGroup
|
||||
};
|
||||
await EC_UpdateSashGroup.InvokeAsync(args);
|
||||
await EC_ReqOptionHw.InvokeAsync(CurrSashGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,11 +311,43 @@ namespace WebWindowTest.Compo
|
||||
/// </summary>
|
||||
/// <param name="updRec"></param>
|
||||
/// <returns></returns>
|
||||
private async Task FirstHwOptionList(int groupId)
|
||||
private async Task FirstHwOptionList()
|
||||
{
|
||||
await EC_CallFirstHwOpt.InvokeAsync(groupId);
|
||||
var args = new DataUpdateSash
|
||||
{
|
||||
currSash = CurrSashGroup
|
||||
};
|
||||
//await EC_UpdatePreview.InvokeAsync(args);
|
||||
await EC_ReqFirstOptionHw.InvokeAsync(CurrSashGroup);
|
||||
}
|
||||
|
||||
private string ButtonMeasureCss(MeasureTypes type)
|
||||
{
|
||||
foreach(var item in CurrSashGroup.SashList)
|
||||
{
|
||||
if (!item.SelMeasureType.Equals(type))
|
||||
return "btn btn-outline-secondary btn-sm";
|
||||
}
|
||||
return "btn btn-secondary btn-sm";
|
||||
}
|
||||
|
||||
private bool isOpen = false;
|
||||
private void ToggleDropdown()
|
||||
{
|
||||
isOpen = !isOpen;
|
||||
}
|
||||
#endregion Private Methods
|
||||
}
|
||||
|
||||
public class DataUpdateSash
|
||||
{
|
||||
public Sash currSash { get; set; } = null!;
|
||||
public bool svgNoHw { get; set; } = false;
|
||||
public bool noSvg { get; set; } = false;
|
||||
}
|
||||
|
||||
public class DataUpdateRes
|
||||
{
|
||||
public DataAction req { get; set; } = DataAction.None;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
|
||||
@using static WebWindowTest.Json.WindowConst
|
||||
|
||||
<div class="card shadow-sm rounded mb-4">
|
||||
<div class="card-header bg-light bg-opacity-25">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="px-2">
|
||||
<h5>@(descParentSplit(CurrItem))</h5>
|
||||
<h5>@(descParentSplit())</h5>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-close" @onclick="ReqClose"></button>
|
||||
@@ -11,119 +12,247 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body py-2">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<h5>Split</h5>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
@if ((CurrItem.nSplitQtyVert == 1 && CurrItem.nSplitQtyHoriz == 0) || (CurrItem.nSplitQtyVert == 0 && CurrItem.nSplitQtyHoriz == 1))
|
||||
{
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => SwapTwoAree(CurrItem)">Swap Aree</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<h5>Split</h5>
|
||||
@if ((CurrSplit.nSplitQtyVert == 1 && CurrSplit.nSplitQtyHoriz == 0) || (CurrSplit.nSplitQtyVert == 0 && CurrSplit.nSplitQtyHoriz == 1))
|
||||
{
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RemoveArea(CurrItem)">Remove split</button>
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => SwapTwoAree()">Swap Aree</button>
|
||||
</div>
|
||||
}
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RemoveArea()">Remove split</button>
|
||||
</div>
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-outline-secondary dropdown-toggle btn-sm" type="button" @onclick="ToggleDropdown">
|
||||
Measure
|
||||
</button>
|
||||
<ul class="dropdown-menu @(isOpen ? "show" : "")" style="min-width:5rem; max-width:10rem">
|
||||
<li>
|
||||
<button class="dropdown-item" @onclick="() => SetMeasureType(MeasureTypes.ABSOLUTE)">
|
||||
Absolute
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button class="dropdown-item" @onclick="() => SetMeasureType(MeasureTypes.PROPORTIONAL)">
|
||||
Proportional
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
<button class="dropdown-item" @onclick="() => SetMeasureType(MeasureTypes.PERCENTAGE)">
|
||||
Percentage
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text">Shape</label>
|
||||
<select class="form-select" @bind="@CurrItem.SelSplitShapeIndex">
|
||||
@foreach (var shapeType in CurrItem.SplitShapeList)
|
||||
<select class="form-select" @bind="@SplitShapeIndex">
|
||||
@foreach (var shapeType in CurrSplit.SplitShapeList)
|
||||
{
|
||||
<option value=@(shapeType.Id)>@(shapeType.Name)</option>
|
||||
}
|
||||
@* <option value="0">Vertical</option>
|
||||
<option value="1">Horizontal</option>
|
||||
<option value="2">Grid</option>
|
||||
<option value="3">Custom</option> *@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@if (CurrItem.nSplitQtyVert > 0)
|
||||
@if (CurrSplit.nSplitQtyVert > 0)
|
||||
{
|
||||
<div class="col-sm-6">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">QtyVert</span>
|
||||
<input type="number" class="form-control" @bind="@CurrItem.nSplitQtyVert">
|
||||
<input type="number" class="form-control" @bind="@SplitQtyVert">
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@if (CurrItem.nSplitQtyHoriz > 0)
|
||||
@if (CurrSplit.nSplitQtyHoriz > 0)
|
||||
{
|
||||
<div class="col-sm-6">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">QtyHoriz</span>
|
||||
<input type="number" class="form-control" @bind="@CurrItem.nSplitQtyHoriz">
|
||||
<input type="number" class="form-control" @bind="@SplitQtyHoriz">
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="row">
|
||||
@if (CurrItem.SplitVertList.Count > 0 && CurrItem.SplitHorizList.Count > 0)
|
||||
@if (CurrSplit.SplitVertList.Count > 0 && CurrSplit.SplitHorizList.Count > 0)
|
||||
{
|
||||
<div class="col-sm-6">
|
||||
@foreach (var dim in CurrItem.SplitVertList)
|
||||
<div class="col-md-12 col-lg-6">
|
||||
@for (int i = 0; i < CurrSplit.SplitVertList.Count; i++)
|
||||
{
|
||||
<div class="input-group mb-2">
|
||||
<EditSplitDimensions CurrRec="CurrSplit.SplitVertList[i]"
|
||||
Name="Width"
|
||||
Index="i"
|
||||
EC_Update="UpdateDimension">
|
||||
</EditSplitDimensions>
|
||||
@* <div class="input-group mb-2">
|
||||
<span class="input-group-text">Width</span>
|
||||
<input type="number" class="form-control" @bind="@dim.dDimension">
|
||||
<span class="input-group-text">%</span>
|
||||
</div>
|
||||
<select class="form-select" style="max-width:6rem; background-color:#e9ecef" @bind="@dim.SelMeasureTypeIndex">
|
||||
@foreach (var mType in dim.MeasureTypeList)
|
||||
{
|
||||
<option value=@(mType.Id)>
|
||||
@switch (mType.Name)
|
||||
{
|
||||
case "Absolute":
|
||||
{
|
||||
<span class="input-group-text">mm</span>
|
||||
break;
|
||||
}
|
||||
case "Proportional":
|
||||
{
|
||||
<span class="input-group-text">*</span>
|
||||
break;
|
||||
}
|
||||
case "Percentage":
|
||||
{
|
||||
<span class="input-group-text">%</span>
|
||||
break;
|
||||
}
|
||||
}
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
</div>*@
|
||||
}
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
@foreach (var dim in CurrItem.SplitHorizList)
|
||||
<div class="col-md-12 col-lg-6">
|
||||
@for (int i = 0; i < CurrSplit.SplitHorizList.Count; i++)
|
||||
{
|
||||
<div class="input-group mb-2">
|
||||
<EditSplitDimensions CurrRec="CurrSplit.SplitHorizList[i]"
|
||||
Name="Height"
|
||||
Index="i"
|
||||
EC_Update="UpdateDimension">
|
||||
</EditSplitDimensions>
|
||||
@* <div class="input-group mb-2">
|
||||
<span class="input-group-text">Height</span>
|
||||
<input type="number" class="form-control" @bind="@dim.dDimension">
|
||||
<span class="input-group-text">%</span>
|
||||
</div>
|
||||
<select class="form-select" style="max-width:6rem; background-color:#e9ecef" @bind="@dim.SelMeasureTypeIndex">
|
||||
@foreach (var mType in dim.MeasureTypeList)
|
||||
{
|
||||
<option value=@(mType.Id)>
|
||||
@switch (mType.Name)
|
||||
{
|
||||
case "Absolute":
|
||||
{
|
||||
<span class="input-group-text">mm</span>
|
||||
break;
|
||||
}
|
||||
case "Proportional":
|
||||
{
|
||||
<span class="input-group-text">*</span>
|
||||
break;
|
||||
}
|
||||
case "Percentage":
|
||||
{
|
||||
<span class="input-group-text">%</span>
|
||||
break;
|
||||
}
|
||||
}
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
</div> *@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (CurrItem.SplitHorizList.Count > 0)
|
||||
else if (CurrSplit.SplitHorizList.Count > 0)
|
||||
{
|
||||
@foreach (var dim in CurrItem.SplitHorizList)
|
||||
@for (int i = 0; i < CurrSplit.SplitHorizList.Count; i++)
|
||||
{
|
||||
<div class="col-sm-6">
|
||||
<EditSplitDimensions CurrRec="CurrSplit.SplitHorizList[i]"
|
||||
Name="Height"
|
||||
Index="i"
|
||||
EC_Update="UpdateDimension">
|
||||
</EditSplitDimensions>
|
||||
@* <div class="col-md-12 col-lg-6">
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">Height</span>
|
||||
<input type="number" class="form-control" @bind="@dim.dDimension">
|
||||
<span class="input-group-text">%</span>
|
||||
<select class="form-select" style="max-width:6rem; background-color:#e9ecef" @bind="@dim.SelMeasureTypeIndex">
|
||||
@foreach (var mType in dim.MeasureTypeList)
|
||||
{
|
||||
<option value=@(mType.Id)>
|
||||
@switch (mType.Name)
|
||||
{
|
||||
case "Absolute":
|
||||
{
|
||||
<span class="input-group-text">mm</span>
|
||||
break;
|
||||
}
|
||||
case "Proportional":
|
||||
{
|
||||
<span class="input-group-text">*</span>
|
||||
break;
|
||||
}
|
||||
case "Percentage":
|
||||
{
|
||||
<span class="input-group-text">%</span>
|
||||
break;
|
||||
}
|
||||
}
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div> *@
|
||||
}
|
||||
}
|
||||
else if (CurrItem.SplitVertList.Count > 0)
|
||||
else if (CurrSplit.SplitVertList.Count > 0)
|
||||
{
|
||||
@foreach (var dim in CurrItem.SplitVertList)
|
||||
@for (int i = 0; i < CurrSplit.SplitVertList.Count; i++)
|
||||
{
|
||||
<div class="col-sm-6">
|
||||
<EditSplitDimensions CurrRec="CurrSplit.SplitVertList[i]"
|
||||
Name="Width"
|
||||
Index="i"
|
||||
EC_Update="UpdateDimension">
|
||||
</EditSplitDimensions>
|
||||
@* <div class="col-md-12 col-lg-6">
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">Width</span>
|
||||
<input type="number" class="form-control" @bind="@dim.dDimension">
|
||||
<span class="input-group-text">%</span>
|
||||
<select class="form-select" style="max-width:6rem; background-color:#e9ecef" @bind="@dim.SelMeasureTypeIndex">
|
||||
@foreach (var mType in dim.MeasureTypeList)
|
||||
{
|
||||
<option value=@(mType.Id)>
|
||||
@switch (mType.Name)
|
||||
{
|
||||
case "Absolute":
|
||||
{
|
||||
<span class="input-group-text">mm</span>
|
||||
break;
|
||||
}
|
||||
case "Proportional":
|
||||
{
|
||||
<span class="input-group-text">*</span>
|
||||
break;
|
||||
}
|
||||
case "Percentage":
|
||||
{
|
||||
<span class="input-group-text">%</span>
|
||||
break;
|
||||
}
|
||||
}
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div> *@
|
||||
}
|
||||
}
|
||||
</div>
|
||||
@if (CurrItem.SelSplitShape == Json.WindowConst.SplitShapes.GRID)
|
||||
@if (CurrSplit.SelSplitShape == Json.WindowConst.SplitShapes.GRID)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="col-md-12 col-lg-6">
|
||||
<div class="d-flex justify-content-start fs-5 mb-2">
|
||||
<div class="px-1">
|
||||
<input class="form-check-input ml-auto" type="checkbox" name="SplitStartVert" checked="@CurrItem.bSplitStartVert" @oninput="(ChangeEventArgs e) => ChangeStartVert(e, CurrItem)">
|
||||
<input class="form-check-input ml-auto" type="checkbox" name="SplitStartVert" checked="@CurrSplit.bSplitStartVert" @oninput="(ChangeEventArgs e) => ChangeStartVert(e)">
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<label class="form-check-label fs-6 text-dark">StartVert</label>
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using WebWindowTest.Models;
|
||||
using static WebWindowTest.Json.WindowConst;
|
||||
using static WebWindowTest.LayoutConst;
|
||||
|
||||
namespace WebWindowTest.Compo
|
||||
{
|
||||
public partial class CardSplit
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Indice del fill corrente rispetto alla lista fill
|
||||
/// Split corrente rispetto alla lista split
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public int CurrIndex { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Fill corrente rispetto alla lista fill
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Split CurrItem { get; set; } = null!;
|
||||
public Split CurrSplit { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Lista di sash
|
||||
@@ -30,28 +28,28 @@ namespace WebWindowTest.Compo
|
||||
public List<Split> SplitList { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Evento per scambiare le aree di uno split
|
||||
/// Frame
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<Area> EC_SwapTwoAree { get; set; }
|
||||
public Frame FrameWindow { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Evento per rimuovere split
|
||||
/// Evento per richiedere reset dizionario
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<Area> EC_RemoveArea { get; set; }
|
||||
public EventCallback<DataUpdateRes> EC_ReqResetDict { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per cambiare nel caso di split a griglia se inizia con lo split verticale
|
||||
/// Evento per aggiornare Split
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<DataChangeStartVert> EC_ChangeStartVert { get; set; }
|
||||
public EventCallback<DataUpdateSplit> EC_UpdateSplit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per richiedere reset dizionario Shape
|
||||
/// Evento per aggiornare Frame
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_ReqResetDictShape { get; set; }
|
||||
public EventCallback<DataUpdateFrame> EC_UpdateFrame { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Evento per tornare nella pagine Tree
|
||||
@@ -60,64 +58,184 @@ namespace WebWindowTest.Compo
|
||||
public EventCallback<bool> EC_ReqClose { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento per scambiare le aree di uno split
|
||||
/// Metodo per scambiare le aree di uno split (solo se si hanno due aree)
|
||||
/// </summary>
|
||||
/// <param name="item"> split corrente </param>
|
||||
/// <returns></returns>
|
||||
protected async Task SwapTwoAree(Split item)
|
||||
protected async Task SwapTwoAree()
|
||||
{
|
||||
// richiesta reset dict shape
|
||||
_ = EC_ReqResetDictShape.InvokeAsync(true);
|
||||
await EC_SwapTwoAree.InvokeAsync(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento per rimuovere split
|
||||
/// </summary>
|
||||
/// <param name="item"> split corrente </param>
|
||||
/// <returns></returns>
|
||||
protected async Task RemoveArea(Split item)
|
||||
{
|
||||
// richiesta reset dict shape
|
||||
await EC_ReqResetDictShape.InvokeAsync(true);
|
||||
await EC_RemoveArea.InvokeAsync(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento per rimuovere split
|
||||
/// </summary>
|
||||
/// <param name="item"> split corrente </param>
|
||||
/// <returns></returns>
|
||||
protected async Task ChangeStartVert(ChangeEventArgs e, Split item)
|
||||
{
|
||||
var Args = new DataChangeStartVert
|
||||
{
|
||||
eventArg = e,
|
||||
currItem = item,
|
||||
CurrSplit.SwapAree();
|
||||
var args = new DataUpdateSplit(){
|
||||
currSplit = CurrSplit,
|
||||
svgNoHw = true
|
||||
};
|
||||
await EC_ChangeStartVert.InvokeAsync(Args);
|
||||
await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = DataAction.ResetDictShape });
|
||||
await EC_UpdateSplit.InvokeAsync(args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per rimuovere split
|
||||
/// </summary>
|
||||
/// <param name="item"> split corrente </param>
|
||||
/// <returns></returns>
|
||||
protected async Task RemoveArea()
|
||||
{
|
||||
CurrSplit.Remove();
|
||||
var args = new DataUpdateFrame()
|
||||
{
|
||||
currFrame = FrameWindow
|
||||
};
|
||||
// richiesta reset dict shape
|
||||
await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = DataAction.ResetDictShape });
|
||||
await EC_UpdateFrame.InvokeAsync(args);
|
||||
await EC_ReqClose.InvokeAsync(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Proprietà per selezionare shape split
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected int SplitShapeIndex
|
||||
{
|
||||
get => CurrSplit.SelSplitShapeIndex;
|
||||
set
|
||||
{
|
||||
if (CurrSplit.SelSplitShapeIndex != value)
|
||||
{
|
||||
CurrSplit.SelSplitShapeIndex = value;
|
||||
var args = new DataUpdateSplit()
|
||||
{
|
||||
currSplit = CurrSplit
|
||||
};
|
||||
// Se la shape selezionata è grid o custom, richiede reset shape
|
||||
if(value > 2)
|
||||
_ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = DataAction.ResetDictShape });
|
||||
if (SearchSash(CurrSplit))
|
||||
_ = EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = DataAction.ResetHwOpt });
|
||||
_ = EC_UpdateSplit.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool SearchSash(Area area)
|
||||
{
|
||||
if (area is Sash)
|
||||
return true;
|
||||
foreach (var item in area.AreaList)
|
||||
return SearchSash(item);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Proprietà per selezionare numero di split verticali
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected int SplitQtyVert
|
||||
{
|
||||
get => CurrSplit.nSplitQtyVert;
|
||||
set
|
||||
{
|
||||
if (CurrSplit.nSplitQtyVert != value)
|
||||
{
|
||||
CurrSplit.nSplitQtyVert = value;
|
||||
var args = new DataUpdateSplit()
|
||||
{
|
||||
currSplit = CurrSplit
|
||||
};
|
||||
_ = EC_UpdateSplit.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Proprietà per selezionare numero di split verticali
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected int SplitQtyHoriz
|
||||
{
|
||||
get => CurrSplit.nSplitQtyHoriz;
|
||||
set
|
||||
{
|
||||
if (CurrSplit.nSplitQtyHoriz != value)
|
||||
{
|
||||
CurrSplit.nSplitQtyHoriz = value;
|
||||
var args = new DataUpdateSplit()
|
||||
{
|
||||
currSplit = CurrSplit
|
||||
};
|
||||
_ = EC_UpdateSplit.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per aggiornare la dimensione dello split
|
||||
/// </summary>
|
||||
/// <param name="updRec"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task UpdateDimension(DataUpdateSplitDimension updRec)
|
||||
{
|
||||
SplitDimension currSplitDim = updRec.currSplit;
|
||||
SplitDimension currRec = null;
|
||||
// cerco il record
|
||||
if (currSplitDim.bIsVertListDim)
|
||||
currRec = CurrSplit.SplitVertList.ElementAt(updRec.index);
|
||||
else
|
||||
currRec = CurrSplit.SplitHorizList.ElementAt(updRec.index);
|
||||
// lo aggiorno
|
||||
if (currSplitDim != null)
|
||||
{
|
||||
currRec = currSplitDim;
|
||||
var args = new DataUpdateSplit()
|
||||
{
|
||||
currSplit = CurrSplit,
|
||||
noSvg = updRec.noSvg
|
||||
};
|
||||
//await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = DataAction.ResetDictShape });
|
||||
await EC_UpdateSplit.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per rimuovere split
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task ChangeStartVert(ChangeEventArgs e)
|
||||
{
|
||||
foreach (Split s in SplitList)
|
||||
{
|
||||
if (s.Equals(CurrSplit))
|
||||
{
|
||||
s.SetSplitStartVert((bool)e.Value);
|
||||
}
|
||||
}
|
||||
var args = new DataUpdateSplit()
|
||||
{
|
||||
currSplit = CurrSplit
|
||||
};
|
||||
await EC_UpdateSplit.InvokeAsync(args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per determinare la descrizione del parent dello split corrente
|
||||
/// </summary>
|
||||
/// <param name="currSplit"> split corrente </param>
|
||||
/// <returns></returns>
|
||||
protected string descParentSplit(Split currSplit)
|
||||
protected string descParentSplit()
|
||||
{
|
||||
if ((currSplit.ParentArea is Splitted || currSplit.ParentArea is Sash) && SashList.Count > 0)
|
||||
if ((CurrSplit.ParentArea is Splitted || CurrSplit.ParentArea is Sash) && SashList.Count > 0)
|
||||
{
|
||||
for (int j = 0; j < SashList.Count; j++)
|
||||
{
|
||||
if (SashList[j].Equals(currSplit.ParentArea))
|
||||
if (SashList[j].Equals(CurrSplit.ParentArea))
|
||||
{
|
||||
return "Sash " + (j + 1);
|
||||
}
|
||||
else if (SashList[j].Equals(currSplit.ParentArea.ParentArea))
|
||||
else if (SashList[j].Equals(CurrSplit.ParentArea.ParentArea))
|
||||
{
|
||||
for (int k = 0; k < SashList[j].AreaList.Count; k++)
|
||||
{
|
||||
if (SashList[j].AreaList[k].AreaList[0].Equals(currSplit))
|
||||
if (SashList[j].AreaList[k].AreaList[0].Equals(CurrSplit))
|
||||
{
|
||||
return "Sash group " + (j + 1) + " - sash " + (k + 1);
|
||||
}
|
||||
@@ -139,11 +257,45 @@ namespace WebWindowTest.Compo
|
||||
{
|
||||
_ = EC_ReqClose.InvokeAsync(true);
|
||||
}
|
||||
|
||||
private bool isOpen = false;
|
||||
private void ToggleDropdown()
|
||||
{
|
||||
isOpen = !isOpen;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per cambiare il tipo di misura di tutti gli SplitDimension
|
||||
/// </summary>
|
||||
/// <param name="type"> nuovo tipo </param>
|
||||
/// <returns></returns>
|
||||
protected async Task SetMeasureType(MeasureTypes type)
|
||||
{
|
||||
isOpen = !isOpen;
|
||||
foreach (var item in CurrSplit.SplitVertList)
|
||||
{
|
||||
item.SetSelMeasureType(type);
|
||||
}
|
||||
foreach (var item in CurrSplit.SplitHorizList)
|
||||
{
|
||||
item.SetSelMeasureType(type);
|
||||
}
|
||||
var args = new DataUpdateSplit()
|
||||
{
|
||||
currSplit = CurrSplit,
|
||||
noSvg = true
|
||||
};
|
||||
await EC_UpdateSplit.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
|
||||
public class DataChangeStartVert
|
||||
/// <summary>
|
||||
/// Classe per raggruppare oggetti che servono per aggiornare split
|
||||
/// </summary>
|
||||
public class DataUpdateSplit
|
||||
{
|
||||
public ChangeEventArgs eventArg { get; set; } = null!;
|
||||
public Split currItem { get; set; }
|
||||
public Split currSplit { get; set; } = null!;
|
||||
public bool svgNoHw { get; set; } = false;
|
||||
public bool noSvg { get; set; } = false;
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,11 @@
|
||||
}
|
||||
<td>
|
||||
<button class="btn btn-sm btn-secondary" style="font-size: 1rem;" @onclick="() => RaiseNextStep(cs, ind)" title="@(s)">@ItemTableList[i].Desc</button>
|
||||
@* @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH ||
|
||||
ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT)
|
||||
{
|
||||
<button class="btn btn-sm btn-secondary" style="font-size: 1rem;" @onclick="() => Remove(cs, ind)" title="Remove">Canc</button>
|
||||
} *@
|
||||
</td>
|
||||
}
|
||||
else
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace WebWindowTest.Compo
|
||||
public EventCallback<DataNextStep> EC_NextStep { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sollevo evento richiesta prossimo step
|
||||
/// Metodo per richiesta prossimo step
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task RaiseNextStep(CompileStep cs, int indexStep)
|
||||
@@ -42,6 +42,16 @@ namespace WebWindowTest.Compo
|
||||
await EC_NextStep.InvokeAsync(Args);
|
||||
}
|
||||
|
||||
//private async Task Remove(CompileStep cs, int indexStep)
|
||||
//{
|
||||
// var Args = new DataNextStep
|
||||
// {
|
||||
// currCompileStep = cs,
|
||||
// index = indexStep,
|
||||
// };
|
||||
// await EC_NextStep.InvokeAsync(Args);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per riempire tabella con contenuto vuoto o con i simboli per rappresentare la struttura
|
||||
/// </summary>
|
||||
|
||||
+11
-4
@@ -3,10 +3,13 @@ using WebWindowTest.Models;
|
||||
|
||||
namespace WebWindowTest.Compo
|
||||
{
|
||||
public partial class EditDimensions
|
||||
public partial class EditFrameDimensions
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Frame dimension corrente
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public FrameDimension CurrRec { get; set; } = null!;
|
||||
|
||||
@@ -17,14 +20,18 @@ namespace WebWindowTest.Compo
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per aggiornare valore dimension
|
||||
/// </summary>
|
||||
private double CurrVal
|
||||
{
|
||||
get => CurrRec.dValue;
|
||||
get => CurrRec.dDimension;
|
||||
set
|
||||
{
|
||||
if (CurrRec.dValue != value)
|
||||
if (CurrRec.dDimension != value)
|
||||
{
|
||||
CurrRec.dValue = value;
|
||||
CurrRec.dDimension = value;
|
||||
CurrRec.dDimension = value;
|
||||
_ = EC_Update.InvokeAsync(CurrRec);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,5 @@
|
||||
@using static WebWindowTest.LayoutConst
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text">@((PositionJoints)(CurrRec.nIndex - 1))</label>
|
||||
<select class="form-select" @bind="@CurrVal">
|
||||
@foreach (var typeJoint in CurrRec.JointTypeList)
|
||||
{
|
||||
<option value="@(typeJoint.Id)">@(typeJoint.Name)</option>
|
||||
}
|
||||
@* <option value="0">Angled</option>
|
||||
<option value="1">Full H</option>
|
||||
<option value="2">Full V</option> *@
|
||||
</select>
|
||||
<span class="input-group-text">@((PositionJoints)(CurrRec.nIndex - 1))</span>
|
||||
<input type="text" readonly class="form-control" value="@(CurrRec.JointTypeList.FirstOrDefault(x => x.Id == (int)CurrRec.SelJointType))">
|
||||
</div>
|
||||
@@ -7,9 +7,13 @@ namespace WebWindowTest.Compo
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Joint corrente
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Joint CurrRec { get; set; } = null!;
|
||||
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<Joint> EC_Update { get; set; }
|
||||
|
||||
@@ -17,7 +21,10 @@ namespace WebWindowTest.Compo
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int CurrVal
|
||||
/// <summary>
|
||||
/// Metodo per aggiornare joint corrente
|
||||
/// </summary>
|
||||
private int CurrJoint
|
||||
{
|
||||
get => CurrRec.SelJointTypeIndex;
|
||||
set
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text">@(CurrOpt.sName)</label>
|
||||
<select class="form-select" @bind="CurrValue">
|
||||
@foreach (var currValueCombo in CurrOpt.ValueList)
|
||||
{
|
||||
<option value="@currValueCombo.sValue">@currValueCombo.sDescription</option>
|
||||
}
|
||||
</select>
|
||||
<span class="input-group-text">@(CurrOpt.sName)</span>
|
||||
@if(CurrValue is String)
|
||||
{
|
||||
<input type="text" readonly class="form-control" value="@CurrOpt.ValueList.FirstOrDefault(x => x.sValue.Equals(CurrValue)).sDescription">
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="number" readonly class="form-control" value="@CurrOpt.ValueList.FirstOrDefault(x => x.sValue == CurrValue).sDescription">
|
||||
}
|
||||
</div>
|
||||
@@ -7,27 +7,22 @@ namespace WebWindowTest.Compo
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Opzione hardware combo corrente
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public AGBOptionCombo CurrOpt { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<AGBOptionCombo> EC_Update { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per aggiornare opzione hardware corrente
|
||||
/// </summary>
|
||||
private string CurrValue
|
||||
{
|
||||
get => CurrOpt.sValue.sValue;
|
||||
set
|
||||
{
|
||||
if (CurrOpt.sValue.sValue != value)
|
||||
{
|
||||
CurrOpt.sValue = CurrOpt.ValueList.FirstOrDefault(x => x.sValue == value);
|
||||
_ = EC_Update.InvokeAsync(CurrOpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
@@ -1,9 +1,29 @@
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text">@(CurrOpt.sName)</label>
|
||||
<select class="form-select" @bind="CurrValue">
|
||||
@foreach (var currValueCombo in CurrOpt.ValueList)
|
||||
<span class="input-group-text">@(CurrOpt.sName)</span>
|
||||
@if (CurrOpt.sName.Equals("HMan"))
|
||||
{
|
||||
<input type="number" readonly class="form-control" value="@CurrValue">
|
||||
}
|
||||
else if (CurrOpt.ValueList.Count > 0)
|
||||
{
|
||||
if(CurrValue is String)
|
||||
{
|
||||
<option value="@currValueCombo">@currValueCombo</option>
|
||||
<input type="text" readonly class="form-control" value="@CurrValue">
|
||||
}
|
||||
</select>
|
||||
else
|
||||
{
|
||||
<input type="number" readonly class="form-control" value="@CurrValue">
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CurrValue is String)
|
||||
{
|
||||
<input type="text" readonly class="form-control" value="@CurrValue">
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="number" readonly class="form-control" value="@CurrValue">
|
||||
}
|
||||
}
|
||||
</div>
|
||||
@@ -7,27 +7,22 @@ namespace WebWindowTest.Compo
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Opzione hardware text corrente
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public AGBOptionText CurrOpt { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<AGBOptionText> EC_Update { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per aggiornare opzione hardware text corrente
|
||||
/// </summary>
|
||||
private string CurrValue
|
||||
{
|
||||
get => CurrOpt.sValue;
|
||||
set
|
||||
{
|
||||
if (CurrOpt.sValue != value)
|
||||
{
|
||||
CurrOpt.sValue = CurrOpt.ValueList.FirstOrDefault(x => x == value);
|
||||
_ = EC_Update.InvokeAsync(CurrOpt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
@using EgwCoreLib.Razor
|
||||
|
||||
<div class="@SplitDimCss()">
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">@Name</span>
|
||||
<input type="number" class="form-control" @bind="@CurrVal">
|
||||
@* <InputDouble CssClass="form-control form-control text-end" Decimals="@CssDecimals()" Step="@CssStepNumber()" @bind-Value="@CurrVal"></InputDouble> *@
|
||||
<select class="form-select" style="max-width:6rem; background-color:#e9ecef" @bind="@CurrType">
|
||||
@foreach (var mType in CurrRec.MeasureTypeList)
|
||||
{
|
||||
<option value=@(mType.Id)>
|
||||
@switch (mType.Name)
|
||||
{
|
||||
case "Absolute":
|
||||
{
|
||||
<span class="input-group-text">mm</span>
|
||||
break;
|
||||
}
|
||||
case "Proportional":
|
||||
{
|
||||
<span class="input-group-text">*</span>
|
||||
break;
|
||||
}
|
||||
case "Percentage":
|
||||
{
|
||||
<span class="input-group-text">%</span>
|
||||
break;
|
||||
}
|
||||
}
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,151 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using WebWindowTest.Models;
|
||||
|
||||
namespace WebWindowTest.Compo
|
||||
{
|
||||
public partial class EditSplitDimensions
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Split dimension corrente
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public SplitDimension CurrRec { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Nome dello split dimension corrente
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Indice dello split dimension
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public int Index { get; set; } = -1;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<DataUpdateSplitDimension> EC_Update { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per aggiornare la dimensione
|
||||
/// </summary>
|
||||
private double CurrVal
|
||||
{
|
||||
get => CurrRec.dDimension;
|
||||
set
|
||||
{
|
||||
if (CurrRec.dDimension != value)
|
||||
{
|
||||
CurrRec.dDimension = (double)Math.Round((decimal)value, CssDecimals());
|
||||
var args = new DataUpdateSplitDimension()
|
||||
{
|
||||
currSplit = CurrRec,
|
||||
index = Index
|
||||
};
|
||||
_ = EC_Update.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per aggiornare il tipo della dimensione
|
||||
/// </summary>
|
||||
private int CurrType
|
||||
{
|
||||
get => CurrRec.SelMeasureTypeIndex;
|
||||
set
|
||||
{
|
||||
if (CurrRec.SelMeasureTypeIndex != value)
|
||||
{
|
||||
CurrRec.SelMeasureTypeIndex = value;
|
||||
var args = new DataUpdateSplitDimension()
|
||||
{
|
||||
currSplit = CurrRec,
|
||||
index=Index,
|
||||
noSvg = true
|
||||
};
|
||||
_ = EC_Update.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SplitDimCss()
|
||||
{
|
||||
if(CurrRec.Parent is Split)
|
||||
{
|
||||
Split s = (Split)CurrRec.Parent;
|
||||
if (s.SelSplitShape.Equals(Json.WindowConst.SplitShapes.GRID))
|
||||
return "";
|
||||
else
|
||||
return "col-md-12 col-lg-6";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per avere il numero di decimali da usare nella form-input
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int CssDecimals()
|
||||
{
|
||||
switch (CurrRec.MeasureType)
|
||||
{
|
||||
case Json.WindowConst.MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
case Json.WindowConst.MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
case Json.WindowConst.MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per avere il lo step da usare nella form-input
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public double CssStepNumber()
|
||||
{
|
||||
switch (CurrRec.MeasureType)
|
||||
{
|
||||
case Json.WindowConst.MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
return 0.5;
|
||||
}
|
||||
case Json.WindowConst.MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
case Json.WindowConst.MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
return 0.5;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe per aggiornare split dimension
|
||||
/// </summary>
|
||||
public class DataUpdateSplitDimension
|
||||
{
|
||||
public SplitDimension currSplit { get; set; } = null!;
|
||||
public int index { get; set; } = -1;
|
||||
public bool noSvg { get; set; } = false;
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
<div class="card-body py-2">
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-sm-12 d-flex flex-column gap-2">
|
||||
<div class="col-md-12 col-lg-6 d-flex flex-column gap-2 flex-wrap">
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<label class="input-group-text">Material</label>
|
||||
<select class="form-select @(cssValid("Material"))" @bind="CurrMaterial">
|
||||
@@ -35,7 +35,7 @@
|
||||
</div>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-sm-12 d-flex flex-column gap-2">
|
||||
<div class="col-md-12 col-lg-6 d-flex flex-column gap-2 mr-2 flex-wrap">
|
||||
<div class="row">
|
||||
<h5>Fill type</h5>
|
||||
</div>
|
||||
@@ -59,11 +59,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-sm-12 d-flex flex-column gap-2">
|
||||
<div class="col-md-12 col-lg-6 d-flex flex-column gap-2 flex-wrap">
|
||||
<div class="row">
|
||||
<h5 class="card-title">Color</h5>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class ="row">
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text">Window</label>
|
||||
<select class="form-select @(cssValid("ColorMaterial"))" @bind="@CurrColor">
|
||||
|
||||
@@ -15,16 +15,7 @@ namespace WebWindowTest.Compo
|
||||
public Window CurrWindow { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> EC_SelColor { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> EC_SelGlass { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> EC_SelWindMat { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> EC_SelProfile { get; set; }
|
||||
public EventCallback<DataUpdateGeneral> EC_UpdateGeneral { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> EC_ReqClose { get; set; }
|
||||
@@ -45,43 +36,71 @@ namespace WebWindowTest.Compo
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Colore corrente
|
||||
/// </summary>
|
||||
protected string CurrColor
|
||||
{
|
||||
get => currColor;
|
||||
set
|
||||
{
|
||||
currColor = value;
|
||||
_ = EC_SelColor.InvokeAsync(value);
|
||||
var args = new DataUpdateGeneral
|
||||
{
|
||||
Color = value,
|
||||
};
|
||||
_ = EC_UpdateGeneral.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Vetro corrente
|
||||
/// </summary>
|
||||
protected string CurrGlass
|
||||
{
|
||||
get => currGlass;
|
||||
set
|
||||
{
|
||||
currGlass = value;
|
||||
_ = EC_SelGlass.InvokeAsync(value);
|
||||
var args = new DataUpdateGeneral
|
||||
{
|
||||
Glass = value,
|
||||
};
|
||||
_ = EC_UpdateGeneral.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Materiale corrente
|
||||
/// </summary>
|
||||
protected string CurrMaterial
|
||||
{
|
||||
get => currMaterial;
|
||||
set
|
||||
{
|
||||
currMaterial = value;
|
||||
_ = EC_SelWindMat.InvokeAsync(value);
|
||||
var args = new DataUpdateGeneral
|
||||
{
|
||||
Material = value,
|
||||
};
|
||||
_ = EC_UpdateGeneral.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Profilo corrente
|
||||
/// </summary>
|
||||
protected string CurrProfile
|
||||
{
|
||||
get => currProfile;
|
||||
set
|
||||
{
|
||||
currProfile = value;
|
||||
_ = EC_SelProfile.InvokeAsync(value);
|
||||
var args = new DataUpdateGeneral
|
||||
{
|
||||
Profile = value,
|
||||
};
|
||||
_ = EC_UpdateGeneral.InvokeAsync(args);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,4 +142,16 @@ namespace WebWindowTest.Compo
|
||||
_ = EC_ReqClose.InvokeAsync(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Classe per aggiornamento dati general
|
||||
/// </summary>
|
||||
public class DataUpdateGeneral
|
||||
{
|
||||
public string Color { get; set; } = "";
|
||||
public string Glass { get; set; } = "";
|
||||
public string Material { get; set; } = "";
|
||||
public string Profile { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,4 @@
|
||||
using Egw.Window.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebWindowTest.DTO
|
||||
{
|
||||
@@ -13,12 +6,7 @@ namespace WebWindowTest.DTO
|
||||
/// Payload complessivo delle anagrafiche necessarie x Window
|
||||
/// </summary>
|
||||
public class BaseListPayload
|
||||
{
|
||||
/// <summary>
|
||||
/// Elenco template in formato DTO
|
||||
/// </summary>
|
||||
public List<TemplateSelectDTO>? TemplateDTO { get; set; } = null;
|
||||
|
||||
{
|
||||
/// <summary>
|
||||
/// Elenco Famiglie HW in formato DTO
|
||||
/// </summary>
|
||||
@@ -49,6 +37,11 @@ namespace WebWindowTest.DTO
|
||||
/// </summary>
|
||||
public List<string> Profile { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Elenco profili ammessi
|
||||
/// </summary>
|
||||
public Dictionary<string,List<Threshold>> Threshold { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Verifica di validità dell'intero Payload
|
||||
/// </summary>
|
||||
@@ -61,7 +54,8 @@ namespace WebWindowTest.DTO
|
||||
bool matOK = Material != null && Material.Count > 0;
|
||||
bool colorOK = ColorMaterial != null && ColorMaterial.Count > 0;
|
||||
bool profileOK = Profile != null && Profile.Count > 0;
|
||||
return famHwOK && glassOK && hwOK && colorOK && matOK && profileOK;
|
||||
bool thresholdOK = Threshold != null && Threshold.Count > 0;
|
||||
return famHwOK && glassOK && hwOK && colorOK && matOK && profileOK && thresholdOK;
|
||||
}
|
||||
/// <summary>
|
||||
/// Verifica che Payload sia almeno parzialmente popolato
|
||||
@@ -75,7 +69,8 @@ namespace WebWindowTest.DTO
|
||||
bool matOK = Material != null && Material.Count > 0;
|
||||
bool colorOK = ColorMaterial != null && ColorMaterial.Count > 0;
|
||||
bool profileOK = Profile != null && Profile.Count > 0;
|
||||
return famHwOK || glassOK || hwOK || colorOK || matOK || profileOK;
|
||||
bool thresholdOK = Threshold != null && Threshold.Count > 0;
|
||||
return famHwOK || glassOK || hwOK || colorOK || matOK || profileOK || thresholdOK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,11 +39,6 @@ namespace WebWindowTest.DTO
|
||||
/// </summary>
|
||||
public string Profile { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Template selezionato
|
||||
/// </summary>
|
||||
public Template Template { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Verifica di validità dell'intero Payload
|
||||
/// </summary>
|
||||
@@ -55,8 +50,7 @@ namespace WebWindowTest.DTO
|
||||
bool glassOk = !string.IsNullOrEmpty(Glass);
|
||||
bool matOK = !string.IsNullOrEmpty(Material);
|
||||
bool profileOK = !string.IsNullOrEmpty(Profile);
|
||||
bool templateOK = Template != null;
|
||||
return famHwOK && colorOK && matOK && glassOk && templateOK && profileOK;
|
||||
return famHwOK && colorOK && matOK && glassOk && profileOK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebWindowTest.DTO
|
||||
{
|
||||
public class TemplateSelectDTO
|
||||
{
|
||||
public int Index { get; set; } = 0;
|
||||
public string Description { get; set; } = "";
|
||||
public string JwdFileName { get; set; } = "";
|
||||
public string SVGFileName { get; set; } = "";
|
||||
public string ImageUrl { get; set; } = "";
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,9 @@ namespace WebWindowTest
|
||||
{
|
||||
public class ItemTable
|
||||
{
|
||||
/// <summary>
|
||||
/// Tipo di area
|
||||
/// </summary>
|
||||
private AreaTypes m_type;
|
||||
public AreaTypes Type
|
||||
{
|
||||
@@ -22,6 +25,9 @@ namespace WebWindowTest
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione
|
||||
/// </summary>
|
||||
private string m_desc;
|
||||
public string Desc
|
||||
{
|
||||
@@ -35,6 +41,9 @@ namespace WebWindowTest
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Numero di riga nell'albero gerarchico
|
||||
/// </summary>
|
||||
private int m_row;
|
||||
public int Row
|
||||
{
|
||||
@@ -48,6 +57,9 @@ namespace WebWindowTest
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Numero di colonna nell'albero gerarchico
|
||||
/// </summary>
|
||||
private int m_col;
|
||||
public int Col
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.VisualBasic;
|
||||
using Egw.Window.Data;
|
||||
using Microsoft.VisualBasic;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -201,6 +202,20 @@ namespace WebWindowTest.Json
|
||||
}
|
||||
}
|
||||
|
||||
private string m_Threshold;
|
||||
[JsonProperty]
|
||||
public string Threshold
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Threshold;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Threshold = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool m_bBottomRail;
|
||||
[JsonProperty]
|
||||
public bool BottomRail
|
||||
@@ -229,13 +244,28 @@ namespace WebWindowTest.Json
|
||||
}
|
||||
}
|
||||
|
||||
//private JsonFrameArcElement m_FrameArcElem;
|
||||
//[JsonProperty]
|
||||
//public JsonFrameArcElement ArcElement
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_FrameArcElem;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_FrameArcElem = value;
|
||||
// }
|
||||
//}
|
||||
|
||||
public JsonFrame() : base(AreaTypes.FRAME)
|
||||
{
|
||||
}
|
||||
|
||||
public JsonFrame(Shapes Shape, bool BottomRail, int BottomRailQty, int GroupId) : base(AreaTypes.FRAME)
|
||||
public JsonFrame(Shapes Shape, string sThreshold, bool BottomRail, int BottomRailQty, int GroupId) : base(AreaTypes.FRAME)
|
||||
{
|
||||
m_Shape = Shape;
|
||||
m_Threshold= sThreshold;
|
||||
m_bBottomRail = BottomRail;
|
||||
m_nBottomRailQty = BottomRailQty;
|
||||
base.GroupId = GroupId;
|
||||
@@ -247,11 +277,15 @@ namespace WebWindowTest.Json
|
||||
newFrame.SetGroupId(GroupId);
|
||||
newFrame.SetAreaType(AreaTypes.FRAME);
|
||||
newFrame.SetSelShape(m_Shape);
|
||||
newFrame.RefreshThresholdList();
|
||||
newFrame.SetSelThresholdFromName(m_Threshold);
|
||||
newFrame.SetBottomRail(m_bBottomRail);
|
||||
newFrame.SetBottomRailQty(m_nBottomRailQty);
|
||||
//if(ArcElement != null)
|
||||
// newFrame.SetFrameArcElem(ArcElement.Deserialize(newFrame, ParentWindow));
|
||||
//Frame.AppliedDone();
|
||||
for (var DimensionIndex = 0; DimensionIndex <= m_DimensionList.Count - 1; DimensionIndex++)
|
||||
newFrame.DimensionList[DimensionIndex].dValue = m_DimensionList[DimensionIndex].Value;
|
||||
newFrame.DimensionList[DimensionIndex].SetDimension(m_DimensionList[DimensionIndex].Value);
|
||||
for (var JointIndex = 0; JointIndex <= m_JointList.Count - 1; JointIndex++)
|
||||
newFrame.JointList[JointIndex].SetSelJointType(m_JointList[JointIndex].JointType);
|
||||
foreach (var Area in AreaList)
|
||||
@@ -311,20 +345,6 @@ namespace WebWindowTest.Json
|
||||
}
|
||||
}
|
||||
|
||||
private List<JsonJoint> m_JointList = new List<JsonJoint>();
|
||||
[JsonProperty]
|
||||
public List<JsonJoint> JointList
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_JointList;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_JointList = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool m_bBottomRail;
|
||||
[JsonProperty]
|
||||
public bool BottomRail
|
||||
@@ -353,6 +373,20 @@ namespace WebWindowTest.Json
|
||||
}
|
||||
}
|
||||
|
||||
//private JsonSashArcElement m_SashArcElem;
|
||||
//[JsonProperty]
|
||||
//public JsonSashArcElement ArcElement
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_SashArcElem;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_SashArcElem = value;
|
||||
// }
|
||||
//}
|
||||
|
||||
private string m_Hardware;
|
||||
[JsonProperty]
|
||||
public string Hardware
|
||||
@@ -409,16 +443,17 @@ namespace WebWindowTest.Json
|
||||
newSash.SashList[SashIndex].SetOpeningType(m_SashList[SashIndex].OpeningType);
|
||||
newSash.SashList[SashIndex].SetHasHandle(m_SashList[SashIndex].HasHandle);
|
||||
newSash.SashList[SashIndex].SetDimension(m_SashList[SashIndex].Dimension);
|
||||
newSash.SashList[SashIndex].SetMeasureType(m_SashList[SashIndex].MeasureType);
|
||||
foreach (var Joint in m_SashList[SashIndex].JointList)
|
||||
newSash.SashList[SashIndex].JointList.Add(Joint.Deserialize((Area)ParentArea));
|
||||
}
|
||||
foreach (var Joint in m_JointList)
|
||||
newSash.JointList.Add(Joint.Deserialize((Area)ParentArea));
|
||||
newSash.SetSelFamilyHardwareFromIndex(Hardware);
|
||||
newSash.ReqRefreshShape();
|
||||
//newSash.ReqRefreshShape();
|
||||
newSash.SetSelHardwareFromId(Hardware);
|
||||
foreach (var HwOption in m_HwOptionList)
|
||||
newSash.SelHwOptionList.Add(HwOption.Name, HwOption.Value);
|
||||
//foreach (var HwOption in m_HwOptionList)
|
||||
// newSash.HwOptionList.Add(HwOption.Deserialize());
|
||||
//if (ArcElement != null)
|
||||
// newSash.SetSashArcElem(ArcElement.Deserialize(newSash, ParentWindow));
|
||||
foreach (var Area in AreaList)
|
||||
{
|
||||
var AreaDeserealized = Area.Deserialize(newSash, ParentWindow);
|
||||
@@ -511,24 +546,24 @@ namespace WebWindowTest.Json
|
||||
Split.SetSplitQtyVert(0);
|
||||
else
|
||||
{
|
||||
//Split.SplitVertList.Clear();
|
||||
Split.SetSplitQtyVert(m_SplitVertList.Count - 1);
|
||||
for (var SplitIndex = 0; SplitIndex <= m_SplitVertList.Count - 1; SplitIndex++)
|
||||
{
|
||||
Split.SplitVertList[SplitIndex].SetIsRelative(m_SplitVertList[SplitIndex].IsRelative);
|
||||
Split.SplitVertList[SplitIndex].SetDimension(m_SplitVertList[SplitIndex].Dimension);
|
||||
Split.SplitVertList[SplitIndex].SetMeasureType(m_SplitVertList[SplitIndex].MeasureType);
|
||||
}
|
||||
}
|
||||
if (m_SplitHorizList.Count == 0)
|
||||
Split.SetSplitQtyHoriz(0);
|
||||
else
|
||||
{
|
||||
//Split.SplitHorizList.Clear();
|
||||
Split.SetSplitQtyHoriz(m_SplitHorizList.Count - 1);
|
||||
for (var SplitIndex = 0; SplitIndex <= m_SplitHorizList.Count - 1; SplitIndex++)
|
||||
{
|
||||
Split.SplitHorizList[SplitIndex].SetIsRelative(m_SplitHorizList[SplitIndex].IsRelative);
|
||||
Split.SplitHorizList[SplitIndex].SetDimension(m_SplitHorizList[SplitIndex].Dimension);
|
||||
Split.SplitHorizList[SplitIndex].SetMeasureType(m_SplitHorizList[SplitIndex].MeasureType);
|
||||
}
|
||||
}
|
||||
foreach (var Area in AreaList)
|
||||
@@ -618,6 +653,107 @@ namespace WebWindowTest.Json
|
||||
}
|
||||
}
|
||||
|
||||
//public class JsonFrameArcElement
|
||||
//{
|
||||
// private double m_Section;
|
||||
// [JsonProperty]
|
||||
// public double Section
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return m_Section;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_Section = value;
|
||||
// }
|
||||
// }
|
||||
|
||||
// private bool m_bCutEdge;
|
||||
// [JsonProperty]
|
||||
// public bool CutEdge
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return m_bCutEdge;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_bCutEdge = value;
|
||||
// }
|
||||
// }
|
||||
|
||||
// private bool m_bIsAlign;
|
||||
// [JsonProperty]
|
||||
// public bool IsAlign
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return m_bIsAlign;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_bIsAlign = value;
|
||||
// }
|
||||
// }
|
||||
|
||||
// public JsonFrameArcElement(double Section, bool CutEdge, bool IsAlign)
|
||||
// {
|
||||
// m_Section = Section;
|
||||
// m_bCutEdge = CutEdge;
|
||||
// m_bIsAlign = IsAlign;
|
||||
// }
|
||||
|
||||
// internal FrameArcElement Deserialize(Area ParentArea, Window ParentWindow)
|
||||
// {
|
||||
// FrameArcElement arcElement = new FrameArcElement(ParentArea, ParentWindow, m_Section, m_bCutEdge, m_bIsAlign);
|
||||
// return arcElement;
|
||||
// }
|
||||
//}
|
||||
|
||||
//public class JsonSashArcElement
|
||||
//{
|
||||
// private double m_Section;
|
||||
// [JsonProperty]
|
||||
// public double Section
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return m_Section;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_Section = value;
|
||||
// }
|
||||
// }
|
||||
|
||||
// private bool m_bCutEdge;
|
||||
// [JsonProperty]
|
||||
// public bool CutEdge
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return m_bCutEdge;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_bCutEdge = value;
|
||||
// }
|
||||
// }
|
||||
|
||||
// public JsonSashArcElement(double Section, bool CutEdge)
|
||||
// {
|
||||
// m_Section = Section;
|
||||
// m_bCutEdge = CutEdge;
|
||||
// }
|
||||
|
||||
// internal SashArcElement Deserialize(Area ParentArea, Window ParentWindow)
|
||||
// {
|
||||
// SashArcElement arcElement = new SashArcElement(ParentArea, ParentWindow, m_Section, m_bCutEdge);
|
||||
// return arcElement;
|
||||
// }
|
||||
//}
|
||||
|
||||
public class JsonJoint
|
||||
{
|
||||
private int m_nIndex;
|
||||
@@ -769,17 +905,14 @@ namespace WebWindowTest.Json
|
||||
}
|
||||
}
|
||||
|
||||
private bool m_bHasHandle;
|
||||
private MeasureTypes m_MeasureType;
|
||||
[JsonProperty]
|
||||
public bool HasHandle
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public MeasureTypes MeasureType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_bHasHandle;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_bHasHandle = value;
|
||||
return m_MeasureType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -797,9 +930,38 @@ namespace WebWindowTest.Json
|
||||
}
|
||||
}
|
||||
|
||||
public JsonSashDimension(Openings OpeningType, bool HasHandle, double Dimension, int SashId)
|
||||
private bool m_bHasHandle;
|
||||
[JsonProperty]
|
||||
public bool HasHandle
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_bHasHandle;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_bHasHandle = value;
|
||||
}
|
||||
}
|
||||
|
||||
private List<JsonJoint> m_JointList = new List<JsonJoint>();
|
||||
[JsonProperty]
|
||||
public List<JsonJoint> JointList
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_JointList;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_JointList = value;
|
||||
}
|
||||
}
|
||||
|
||||
public JsonSashDimension(Openings OpeningType, MeasureTypes MeasureType, bool HasHandle, double Dimension, int SashId)
|
||||
{
|
||||
m_OpeningType = OpeningType;
|
||||
m_MeasureType = MeasureType;
|
||||
m_bHasHandle = HasHandle;
|
||||
m_dDimension = Dimension;
|
||||
m_nSashId = SashId;
|
||||
@@ -832,10 +994,22 @@ namespace WebWindowTest.Json
|
||||
}
|
||||
}
|
||||
|
||||
public JsonSplitDimension(bool IsRelative, double Dimension)
|
||||
private MeasureTypes m_MeasureType;
|
||||
[JsonProperty]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public MeasureTypes MeasureType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_MeasureType;
|
||||
}
|
||||
}
|
||||
|
||||
public JsonSplitDimension(bool IsRelative, double Dimension, MeasureTypes MeasureType)
|
||||
{
|
||||
m_bIsRelative = IsRelative;
|
||||
m_dDimension = Dimension;
|
||||
m_MeasureType = MeasureType;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,6 +118,14 @@ namespace WebWindowTest.Json
|
||||
COMBO = 3
|
||||
}
|
||||
|
||||
public enum MeasureTypes: int
|
||||
{
|
||||
NULL = 0,
|
||||
ABSOLUTE = 1,
|
||||
PROPORTIONAL = 2,
|
||||
PERCENTAGE = 3
|
||||
}
|
||||
|
||||
// Specifies the display state of an element.
|
||||
public enum Visibility
|
||||
{
|
||||
|
||||
@@ -10,13 +10,13 @@ namespace WebWindowTest
|
||||
{
|
||||
public enum CompileStep
|
||||
{
|
||||
Template = 0,
|
||||
Tree = 1,
|
||||
Frame,
|
||||
Tree = 0,
|
||||
Frame = 1,
|
||||
Split,
|
||||
Sash,
|
||||
Fill,
|
||||
General
|
||||
General,
|
||||
ArcElement
|
||||
}
|
||||
|
||||
public enum PositionJoints
|
||||
@@ -26,5 +26,22 @@ namespace WebWindowTest
|
||||
TR, // Top Right
|
||||
TL // Top Left
|
||||
}
|
||||
|
||||
public enum DataAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Nessuna richiesta
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Reset dizionario shape
|
||||
/// </summary>
|
||||
ResetDictShape,
|
||||
/// <summary>
|
||||
/// Reset dizionario HwOptions
|
||||
/// </summary>
|
||||
ResetHwOpt
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,9 +50,18 @@ namespace WebWindowTest.Models
|
||||
public AGBOptionText(ParametriOpzioniParametri HdwOptionParam) : base(HdwOptionParam)
|
||||
{
|
||||
m_Type = HwOptionTypes.TEXT;
|
||||
foreach (var Value in HdwOptionParam.Opzioni)
|
||||
m_ValueList.Add(Value.Valore);
|
||||
m_sValue = m_ValueList.FirstOrDefault(x => x == HdwOptionParam.ValoreCorrente) ?? "";
|
||||
if(HdwOptionParam.Opzioni != null)
|
||||
{
|
||||
foreach (var Value in HdwOptionParam.Opzioni)
|
||||
m_ValueList.Add(Value.Valore);
|
||||
m_sValue = m_ValueList.FirstOrDefault(x => x == HdwOptionParam.ValoreCorrente);
|
||||
if (string.IsNullOrEmpty(m_sValue))
|
||||
m_sValue = m_ValueList.FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sValue = HdwOptionParam.ValoreCorrente;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
+439
-13
@@ -1,4 +1,5 @@
|
||||
using WebWindowTest.Json;
|
||||
using System.ComponentModel.Design;
|
||||
using WebWindowTest.Json;
|
||||
using static WebWindowTest.Json.WindowConst;
|
||||
|
||||
namespace WebWindowTest.Models
|
||||
@@ -69,7 +70,6 @@ namespace WebWindowTest.Models
|
||||
set
|
||||
{
|
||||
m_nAreaId = value;
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,8 +108,15 @@ namespace WebWindowTest.Models
|
||||
SashArea.SetSelFamilyHardware("");
|
||||
// Inserisco hardware di default
|
||||
SashArea.SetSelHardwareFromId("000000");
|
||||
//if (ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.ARC ||
|
||||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.DOUBLEARC ||
|
||||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.ARC_FULL ||
|
||||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.THREECENTERARC)
|
||||
// SashArea.SashArcElem = new SashArcElement(SashArea, ParentWindow, 10, true);
|
||||
//else
|
||||
// SashArea.SashArcElem = null;
|
||||
// Salvo gli oggetti già presenti e li cancello da AreaList
|
||||
List<Area> ContentArea = new List<Area>();
|
||||
List <Area> ContentArea = new List<Area>();
|
||||
ContentArea.Add(AreaList[0]);
|
||||
AreaList.Remove(AreaList[0]);
|
||||
// Aggiungo area
|
||||
@@ -117,8 +124,6 @@ namespace WebWindowTest.Models
|
||||
// Inserisco il riempimento precedente
|
||||
AreaList[0].AreaList.Add(ContentArea[0]);
|
||||
AreaList[0].AreaList[0].SetParentArea(AreaList[0]);
|
||||
// Richiesta SVG con hardware di default
|
||||
ParentWindow.OnUpdatePreview(ParentWindow.sSerialized());
|
||||
}
|
||||
|
||||
public void AddSplit()
|
||||
@@ -140,24 +145,23 @@ namespace WebWindowTest.Models
|
||||
List<Splitted> newSplittedList = new List<Splitted>();
|
||||
for (int i = 0; i < 2; i++)
|
||||
newSplittedList.Add(Splitted.CreateSplitted(SplitArea));
|
||||
// Inserisco nelle aree Splitted il Fill salvato e un Fill uguale (e setto ParentArea del fill)
|
||||
ContentArea[0].SetParentArea(newSplittedList[0]);
|
||||
newSplittedList[0].AreaList.Add(ContentArea[0]);
|
||||
// Inserisco nelle aree Splitted Fill e la struttura precedente (e setto ParentArea del fill)
|
||||
ContentArea[0].SetParentArea(newSplittedList[1]);
|
||||
newSplittedList[1].AreaList.Add(ContentArea[0]);
|
||||
if (ContentArea[0] is Fill)
|
||||
{
|
||||
Fill fill1 = (Fill)ContentArea[0];
|
||||
Fill fill2 = Fill.CreateFill(newSplittedList[1], fill1.FillType);
|
||||
newSplittedList[1].AreaList.Add(fill2);
|
||||
Fill fill2 = Fill.CreateFill(newSplittedList[0], fill1.FillType);
|
||||
newSplittedList[0].AreaList.Add(fill2);
|
||||
}
|
||||
else
|
||||
{
|
||||
Fill fill2 = Fill.CreateFill(newSplittedList[1], FillTypes.GLASS);
|
||||
newSplittedList[1].AreaList.Add(fill2);
|
||||
Fill fill2 = Fill.CreateFill(newSplittedList[0], FillTypes.GLASS);
|
||||
newSplittedList[0].AreaList.Add(fill2);
|
||||
}
|
||||
// All'area Split aggiunto le due aree Splitted
|
||||
for (int i = 0; i < 2; i++)
|
||||
AreaList[0].AreaList.Add(newSplittedList[i]);
|
||||
ParentWindow.OnUpdatePreview(ParentWindow.sSerialized());
|
||||
}
|
||||
|
||||
public abstract Area Copy(Area ParentArea);
|
||||
@@ -176,6 +180,202 @@ namespace WebWindowTest.Models
|
||||
AreaList[0] = AreaList[1];
|
||||
AreaList[1] = tempArea;
|
||||
}
|
||||
Frame frame = ParentWindow.AreaList.First();
|
||||
switch (frame.Shape)
|
||||
{
|
||||
case Shapes.RECTANGLE:
|
||||
case Shapes.ARC_FULL:
|
||||
case Shapes.TRIANGLE:
|
||||
{
|
||||
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width");
|
||||
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Height")).First().dDimension, "Height");
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.RIGHTCHAMFER:
|
||||
{
|
||||
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width");
|
||||
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Left Height")).First().dDimension, "Left Height");
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.LEFTCHAMFER:
|
||||
{
|
||||
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width");
|
||||
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Right Height")).First().dDimension, "Right Height");
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.DOUBLECHAMFER:
|
||||
case Shapes.ARC:
|
||||
{
|
||||
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width");
|
||||
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Full Height")).First().dDimension, "Full Height");
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.DOUBLEARC:
|
||||
{
|
||||
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width");
|
||||
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Full Height")).First().dDimension, "Full Height");
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.THREECENTERARC:
|
||||
{
|
||||
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Width")).First().dDimension, "Width");
|
||||
SearchAreaList(this, frame.DimensionList.Where(x => x.sName.Equals("Full Height")).First().dDimension, "Full Height");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cerca nell'albero gli oggetti Sash e Split per associare la larghezza
|
||||
/// </summary>
|
||||
/// <param name="node"></param>
|
||||
public void SearchAreaList(Area node, double dim, string nameDim)
|
||||
{
|
||||
if (node != null)
|
||||
{
|
||||
if (node.AreaType.Equals(AreaTypes.SASH))
|
||||
UpdateDimSubArea((Sash)node, dim, nameDim);
|
||||
else if (node.AreaType.Equals(AreaTypes.SPLIT))
|
||||
UpdateDimSubArea((Split)node, dim, nameDim);
|
||||
for (int i = 0; i < node.AreaList.Count; i++)
|
||||
{
|
||||
if (node.AreaType.Equals(AreaTypes.SASH))
|
||||
{
|
||||
Sash s = (Sash)node;
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
foreach (var item in s.SashList)
|
||||
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType));
|
||||
if(nameDim.Equals("Width"))
|
||||
SearchAreaList(node.AreaList.ElementAt(i), s.SashList.ElementAt(i).CalculateAbsoluteValue(dimList, dim), nameDim);
|
||||
else
|
||||
SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim);
|
||||
}
|
||||
else if (node.AreaType.Equals(AreaTypes.SPLIT))
|
||||
{
|
||||
Split s = (Split)node;
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
if (s.SplitHorizList.Count > 0 && i < s.SplitHorizList.Count)
|
||||
{
|
||||
foreach (var item in s.SplitHorizList)
|
||||
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType));
|
||||
if(nameDim.Equals("Width"))
|
||||
SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim);
|
||||
else
|
||||
SearchAreaList(node.AreaList.ElementAt(i), s.SplitHorizList.ElementAt(i).CalculateAbsoluteValue(dimList, dim), nameDim);
|
||||
}
|
||||
if (s.SplitVertList.Count > 0 && i < s.SplitVertList.Count)
|
||||
{
|
||||
foreach (var item in s.SplitVertList)
|
||||
dimList.Add(new AreaDimension(item.dDimension, item.MeasureType));
|
||||
if(nameDim.Equals("Width"))
|
||||
SearchAreaList(node.AreaList.ElementAt(i), s.SplitVertList.ElementAt(i).CalculateAbsoluteValue(dimList, dim), nameDim);
|
||||
else
|
||||
SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim);
|
||||
}
|
||||
}
|
||||
else
|
||||
SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateDimSubArea(Area area, double dim, string nameDim)
|
||||
{
|
||||
if (area is Sash && nameDim.Equals("Width"))
|
||||
{
|
||||
Sash sash = (Sash)area;
|
||||
int countAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count();
|
||||
int countProportional = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).Count();
|
||||
int countPercentage = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).Count();
|
||||
List<AreaDimension> dimList = new List<AreaDimension>();
|
||||
Split split = new Split(null, null);
|
||||
if (sash.ParentArea.ParentArea is Split)
|
||||
split = (Split)sash.ParentArea.ParentArea;
|
||||
if (sash.ParentArea is Frame || (sash.ParentArea.ParentArea is Split && split.SplitHorizList.Count > 0))
|
||||
{
|
||||
Frame frame = new Frame(null, null);
|
||||
if(split.SplitHorizList.Count > 0)
|
||||
frame = (Frame)sash.ParentArea.ParentArea.ParentArea;
|
||||
else
|
||||
frame = (Frame)sash.ParentArea;
|
||||
foreach (var i in frame.DimensionList)
|
||||
dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType));
|
||||
}
|
||||
else
|
||||
{
|
||||
//Split s = (Split)sash.ParentArea.ParentArea;
|
||||
foreach (var i in split.SplitVertList)
|
||||
dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType));
|
||||
}
|
||||
if (countAbsolute == sash.SashList.Count)
|
||||
{
|
||||
double sum = sash.SashList.Sum(x => x.dDimension);
|
||||
double res = dim - sum;
|
||||
if (res > 0)
|
||||
{
|
||||
foreach (var sashDim in sash.SashList)
|
||||
{
|
||||
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var sashDim in sash.SashList)
|
||||
{
|
||||
// Sommo perchè res è negativo
|
||||
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (countAbsolute < sash.SashList.Count && countPercentage != sash.SashList.Count && countProportional != sash.SashList.Count)
|
||||
{
|
||||
if (countPercentage > 0 && countPercentage <= sash.SashList.Count && countProportional == 0)
|
||||
{
|
||||
double sumAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Sum(x => x.dDimension);
|
||||
var percentageList = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList();
|
||||
foreach (var i in percentageList)
|
||||
{
|
||||
i.SetDimension(i.ConvertIn(dimList, (dim - sumAbsolute) / countPercentage, i.MeasureType, dim));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (area is Split)
|
||||
{
|
||||
Split split = (Split)area;
|
||||
List<SplitDimension> splitList = new List<SplitDimension>();
|
||||
if (nameDim.Equals("Width"))
|
||||
splitList = split.SplitVertList;
|
||||
else
|
||||
splitList = split.SplitHorizList;
|
||||
int countAbsolute = splitList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count();
|
||||
if (countAbsolute != 0 && countAbsolute == splitList.Count)
|
||||
{
|
||||
double sum = splitList.Sum(x => x.dDimension);
|
||||
double res = 0;
|
||||
res = dim - sum;
|
||||
if (res > 0)
|
||||
{
|
||||
foreach (var item in splitList)
|
||||
{
|
||||
item.SetDimension(item.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in splitList)
|
||||
{
|
||||
// Sommo perchè res è negativo
|
||||
item.SetDimension(item.dDimension + res / countAbsolute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
@@ -194,6 +394,232 @@ namespace WebWindowTest.Models
|
||||
m_ParentArea = ParentArea;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire da misura proporzionale a misura assoluta o percentuale
|
||||
/// </summary>
|
||||
/// <param name="newType"></param>
|
||||
/// <returns></returns>
|
||||
internal double ConvertFromPropVal(Sash sashGroup, double sashDim, MeasureTypes newType, double widthTot)
|
||||
{
|
||||
double tot = widthTot;
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in sashGroup.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = sashGroup.SashList
|
||||
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this))
|
||||
.Sum(m => m.CalculateAbsoluteValue(adList, tot));
|
||||
//Calcolo residuo
|
||||
double res = tot - sumNotProp;
|
||||
if (res < 0) res = 0;
|
||||
//Misure proporzionali
|
||||
var proportionalList = sashGroup.SashList
|
||||
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
.ToList();
|
||||
|
||||
double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
if (sumPesi == 0) sumPesi = 1;
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
return res / sumPesi * sashDim;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (res / sumPesi * sashDim) / tot * 100;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire da misura proporzionale a misura assoluta o percentuale
|
||||
/// </summary>
|
||||
/// <param name="newType"></param>
|
||||
/// <returns></returns>
|
||||
internal double ConvertFromPropVal(List<SplitDimension> splitList, double splitDim, MeasureTypes newType, double widthTot)
|
||||
{
|
||||
double tot = widthTot;
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in splitList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = splitList
|
||||
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this))
|
||||
.Sum(m => m.CalculateAbsoluteValue(adList, tot));
|
||||
//Calcolo residuo
|
||||
double res = tot - sumNotProp;
|
||||
if (res < 0) res = 0;
|
||||
//Misure proporzionali
|
||||
var proportionalList = splitList
|
||||
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
.ToList();
|
||||
|
||||
double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
if (sumPesi == 0)
|
||||
sumPesi = 1;
|
||||
return res / sumPesi * splitDim;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per calcolare larghezza area
|
||||
/// </summary>
|
||||
/// <param name="area"> area di partenza </param>
|
||||
/// <param name="width"> larghezza di partenza </param>
|
||||
/// <returns></returns>
|
||||
public double CalculateWidthArea(Area area, double width)
|
||||
{
|
||||
for (int i = 0; i < area.AreaList.Count; i++)
|
||||
{
|
||||
double risultato = -1;
|
||||
if (area.Equals(this))
|
||||
return width;
|
||||
Area item = area.AreaList[i];
|
||||
if (area is Split)
|
||||
{
|
||||
Split split = (Split)area;
|
||||
if (split.SplitVertList.Count > 0)
|
||||
{
|
||||
switch (split.SplitVertList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
risultato = CalculateWidthArea(item, split.SplitVertList.ElementAt(i).dDimension);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
risultato = CalculateWidthArea(item, ConvertFromPropVal(split.SplitVertList, split.SplitVertList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, width));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
risultato = CalculateWidthArea(item, split.SplitVertList.ElementAt(i).dDimension * width / 100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
risultato = CalculateWidthArea(item, width);
|
||||
}
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
else if (area is Sash)
|
||||
{
|
||||
Sash sash = (Sash)area;
|
||||
switch (sash.SashList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
risultato = CalculateWidthArea(item, sash.SashList.ElementAt(i).dDimension);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
risultato = CalculateWidthArea(item, ConvertFromPropVal(sash, sash.SashList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, width));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
risultato = CalculateWidthArea(item, sash.SashList.ElementAt(i).dDimension * width / 100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
else
|
||||
{
|
||||
risultato = CalculateWidthArea(item, width);
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per calcolare larghezza area
|
||||
/// </summary>
|
||||
/// <param name="area"> area di partenza </param>
|
||||
/// <param name="height"> altezza di partenza </param>
|
||||
/// <returns></returns>
|
||||
public double CalculateHeightArea(Area area, double height)
|
||||
{
|
||||
for (int i = 0; i < area.AreaList.Count; i++)
|
||||
{
|
||||
double risultato = -1;
|
||||
if (area.Equals(this))
|
||||
return height;
|
||||
Area item = area.AreaList[i];
|
||||
if (area is Split)
|
||||
{
|
||||
Split split = (Split)area;
|
||||
if (split.SplitHorizList.Count > 0)
|
||||
{
|
||||
switch (split.SplitHorizList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
risultato = CalculateHeightArea(item, split.SplitHorizList.ElementAt(i).dDimension);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
risultato = CalculateHeightArea(item, ConvertFromPropVal(split.SplitHorizList, split.SplitHorizList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, height) );
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
risultato = CalculateHeightArea(item, split.SplitHorizList.ElementAt(i).dDimension * height / 100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
risultato = CalculateHeightArea(item, height);
|
||||
}
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
else if (area is Sash)
|
||||
{
|
||||
Sash sash = (Sash)area;
|
||||
switch (sash.SashList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
risultato = CalculateHeightArea(item, sash.SashList.ElementAt(i).dDimension);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
risultato = CalculateHeightArea(item, ConvertFromPropVal(sash, sash.SashList.ElementAt(i).dDimension, MeasureTypes.ABSOLUTE, height));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
risultato = CalculateHeightArea(item, sash.SashList.ElementAt(i).dDimension * height / 100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
else
|
||||
{
|
||||
risultato = CalculateHeightArea(item, height);
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
}
|
||||
return height;
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
@@ -0,0 +1,350 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static WebWindowTest.Json.WindowConst;
|
||||
|
||||
namespace WebWindowTest.Models
|
||||
{
|
||||
public class AreaDimension
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public AreaDimension(double dDimension, MeasureTypes MeasureType)
|
||||
{
|
||||
m_dDimension = dDimension;
|
||||
m_SelMeasureType = MeasureType;
|
||||
//m_Parent = Parent;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public virtual double dDimension
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_dDimension;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
}
|
||||
|
||||
//public Area Parent
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_Parent;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_Parent = value;
|
||||
// }
|
||||
//}
|
||||
|
||||
public MeasureTypes MeasureType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SelMeasureType;
|
||||
}
|
||||
}
|
||||
|
||||
public List<IdNameStruct> MeasureTypeList
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_MeasureTypeList;
|
||||
}
|
||||
}
|
||||
|
||||
public MeasureTypes SelMeasureType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SelMeasureType;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_SelMeasureType = value;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual int SelMeasureTypeIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)m_SelMeasureType;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (m_SelMeasureType != (MeasureTypes)value)
|
||||
{
|
||||
MeasureTypes newType = (MeasureTypes)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Fields
|
||||
|
||||
protected double m_dDimension;
|
||||
|
||||
protected List<IdNameStruct> m_MeasureTypeList = new List<IdNameStruct>
|
||||
{
|
||||
new IdNameStruct((int)MeasureTypes.ABSOLUTE, "Absolute"),
|
||||
new IdNameStruct((int)MeasureTypes.PROPORTIONAL, "Proportional"),
|
||||
new IdNameStruct((int)MeasureTypes.PERCENTAGE, "Percentage"),
|
||||
};
|
||||
|
||||
protected MeasureTypes m_SelMeasureType;
|
||||
|
||||
// reference
|
||||
// protected Area m_Parent;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void SetDimension(double dValue)
|
||||
{
|
||||
m_dDimension = dValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire la dimensione dal vecchio tipo al nuovo tipo
|
||||
/// </summary>
|
||||
/// <param name="oldType"> Vecchio tipo </param>
|
||||
/// <param name="newType"> Nuovo tipo </param>
|
||||
/// <returns></returns>
|
||||
public double ConvertDimension(List<AreaDimension> itemList, MeasureTypes oldType, MeasureTypes newType, double widthTot, int indexSash)
|
||||
{
|
||||
switch (oldType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.PERCENTAGE))
|
||||
{
|
||||
//return Double.Round((m_dDimension / m_Parent.Width) * 100, 1);
|
||||
return (dDimension / widthTot) * 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Double.Round(CalculatePropVal(itemList, indexSash, widthTot));
|
||||
}
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
//return Double.Round(ConvertFromPropVal(newType), 2);
|
||||
return ConvertFromPropVal(itemList, newType, widthTot);
|
||||
}
|
||||
else
|
||||
{
|
||||
//return Double.Round(ConvertFromPropVal(newType), 1);
|
||||
return ConvertFromPropVal(itemList, newType, widthTot);
|
||||
}
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
//return Double.Round((m_dDimension * m_Parent.Width) / 100, 2);
|
||||
return (dDimension * widthTot) / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Double.Round(CalculatePropVal(itemList, indexSash, widthTot));
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
/// <summary>
|
||||
/// Calcolo MCD
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <returns></returns>
|
||||
internal double CalculateMCD(double a, double b)
|
||||
{
|
||||
while (b >= 0.01)
|
||||
{
|
||||
double temp = b;
|
||||
b = a % b;
|
||||
a = temp;
|
||||
}
|
||||
//return Double.Round(a,2);
|
||||
return a;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal double CalculatePropVal(List<AreaDimension> itemList, int indexArea, double widthTot)
|
||||
{
|
||||
if (itemList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
List<double> absoluteValue = new List<double>();
|
||||
foreach (var item in itemList)
|
||||
{
|
||||
absoluteValue.Add(item.CalculateAbsoluteValue(itemList, widthTot));
|
||||
}
|
||||
int numProportional = itemList.Where(x => x.SelMeasureType == MeasureTypes.PROPORTIONAL).Count();
|
||||
if(itemList.Count > 2 && numProportional == itemList.Count - 1)
|
||||
{
|
||||
int inedMin = absoluteValue.IndexOf(absoluteValue.Min());
|
||||
var mcd = CalculateMCD(absoluteValue.ElementAt(indexArea), absoluteValue.ElementAt(inedMin));
|
||||
itemList.ElementAt(inedMin).SetDimension(absoluteValue.ElementAt(inedMin) / mcd);
|
||||
itemList.ElementAt(indexArea).SetDimension(absoluteValue.ElementAt(indexArea) / mcd);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < itemList.Count; i++)
|
||||
{
|
||||
if (!itemList.ElementAt(i).Equals(this) &&
|
||||
itemList.ElementAt(i).MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
{
|
||||
if (absoluteValue.ElementAt(indexArea) <= absoluteValue.ElementAt(i))
|
||||
{
|
||||
var mcd = CalculateMCD(absoluteValue.ElementAt(indexArea), absoluteValue.ElementAt(i));
|
||||
itemList.ElementAt(i).SetDimension(absoluteValue.ElementAt(i) / mcd);
|
||||
itemList.ElementAt(indexArea).SetDimension(absoluteValue.ElementAt(indexArea) / mcd);
|
||||
}
|
||||
else
|
||||
{
|
||||
var mcd = CalculateMCD(absoluteValue.ElementAt(indexArea), absoluteValue.ElementAt(i));
|
||||
itemList.ElementAt(i).SetDimension(absoluteValue.ElementAt(i) / mcd);
|
||||
itemList.ElementAt(indexArea).SetDimension(absoluteValue.ElementAt(indexArea) / mcd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return itemList.ElementAt(indexArea).dDimension;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per trasformare una dimensione in valore assoluto rispetto alla larghezza totale
|
||||
/// </summary>
|
||||
/// <param name="widthTot"> Larghezza totale </param>
|
||||
/// <returns></returns>
|
||||
internal double CalculateAbsoluteValue(List<AreaDimension> itemList, double widthTot)
|
||||
{
|
||||
switch (SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
//return Double.Round(dDimension, 2);
|
||||
return dDimension;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
//return Double.Round(Proportional2AbsolutVal(), 2);
|
||||
return ProportionalToAbsoluteVal(itemList, dDimension, widthTot);
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
//return Double.Round((dDimension / 100) * widthTot, 1);
|
||||
return (dDimension / 100) * widthTot;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire una dimensione da un valore assoluto al suo rispettivo tipo
|
||||
/// </summary>
|
||||
/// <param name="absoluteVal"> Valore assoluto </param>
|
||||
/// <param name="type"> Tipo di misura della dimensione </param>
|
||||
/// <param name="widthTot"> Larghezza totale </param>
|
||||
/// <returns></returns>
|
||||
internal double ConvertIn(List<AreaDimension> itemList, double absoluteVal, MeasureTypes type, double widthTot)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
return absoluteVal;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
return ProportionalToAbsoluteVal(itemList, absoluteVal, widthTot);
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
return (absoluteVal / widthTot) * 100;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire da misura proporzionale a misura assoluta o percentuale
|
||||
/// </summary>
|
||||
/// <param name="newType"></param>
|
||||
/// <returns></returns>
|
||||
internal double ConvertFromPropVal(List<AreaDimension> itemList, MeasureTypes newType, double widthTot)
|
||||
{
|
||||
double tot = widthTot;
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = itemList.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this))
|
||||
.Sum(m => m.CalculateAbsoluteValue(itemList, tot));
|
||||
//Calcolo residuo
|
||||
double res = tot - sumNotProp;
|
||||
if (res < 0) res = 0;
|
||||
//Misure proporzionali
|
||||
var proportionalList = itemList.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
.ToList();
|
||||
|
||||
double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
if (sumPesi == 0) sumPesi = 1;
|
||||
if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
{
|
||||
return res / sumPesi * dDimension;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (res / sumPesi * dDimension) / tot * 100;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per trasformare il valore proporzionale in assoluto
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal double ProportionalToAbsoluteVal(List<AreaDimension> itemList, double dimensionProp, double widthTot)
|
||||
{
|
||||
double tot = widthTot;
|
||||
//Somma misura non proporzionali
|
||||
double sumNotProp = itemList.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL)
|
||||
.Sum(m => m.CalculateAbsoluteValue(itemList, tot));
|
||||
//Calcolo residuo
|
||||
double res = tot - sumNotProp;
|
||||
if (res < 0) res = 0;
|
||||
//Misure proporzionali
|
||||
var proportionalList = itemList.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
.ToList();
|
||||
double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
if (sumPesi == 0) sumPesi = 1;
|
||||
return res / sumPesi * dimensionProp;
|
||||
}
|
||||
|
||||
|
||||
#endregion Public Method
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,6 @@ namespace WebWindowTest.Models
|
||||
set
|
||||
{
|
||||
m_SelFillType = (FillTypes)IdNameStruct.IdFromInd(value, m_FillTypeList);
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +96,6 @@ namespace WebWindowTest.Models
|
||||
internal void SetSelFillType(FillTypes value)
|
||||
{
|
||||
m_SelFillType = value;
|
||||
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
internal void SetFillType(FillTypes value)
|
||||
{
|
||||
|
||||
+209
-29
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Egw.Window.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -10,6 +11,13 @@ namespace WebWindowTest.Models
|
||||
{
|
||||
public class Frame : Area
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
// Lista hardware completa passata dal chiamante del componente
|
||||
public static Dictionary<string, List<Threshold>> m_AllThresholdList = new Dictionary<string, List<Threshold>>();
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public Frame(Area ParentArea, Window ParentWindow) : base(ParentArea, ParentWindow)
|
||||
@@ -20,6 +28,18 @@ namespace WebWindowTest.Models
|
||||
|
||||
#region Public Properties
|
||||
|
||||
//public FrameArcElement? FrameArcElem
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_FrameArcElem;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_FrameArcElem = value!;
|
||||
// }
|
||||
//}
|
||||
|
||||
public bool BottomRail
|
||||
{
|
||||
get
|
||||
@@ -29,7 +49,42 @@ namespace WebWindowTest.Models
|
||||
set
|
||||
{
|
||||
m_bBottomRail = value;
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
public List<Threshold> ThresholdList
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_ThresholdList;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_ThresholdList = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Threshold SelThreshold
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SelThreshold;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_SelThreshold = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int SelThresholdFromType
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SelThreshold.Type;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_SelThreshold = m_ThresholdList.Where(x => x.Type.Equals(value)).First();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +108,6 @@ namespace WebWindowTest.Models
|
||||
m_bBottomRail = false;
|
||||
}
|
||||
}
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,12 +133,10 @@ namespace WebWindowTest.Models
|
||||
{
|
||||
get
|
||||
{
|
||||
//return IdNameStruct.IndFromId((int)m_Shape, m_ShapeList);
|
||||
return (int)m_Shape;
|
||||
}
|
||||
set
|
||||
{
|
||||
//Shapes SelShape = (Shapes)IdNameStruct.IdFromInd(value, m_ShapeList);
|
||||
Shapes SelShape = (Shapes)value;
|
||||
if (m_Shape != SelShape)
|
||||
{
|
||||
@@ -92,7 +144,8 @@ namespace WebWindowTest.Models
|
||||
List<FrameDimension> oldDimensionList = new List<FrameDimension>(DimensionList);
|
||||
// verifico parametri Dimension
|
||||
DimensionList.Clear();
|
||||
double widthVal = oldDimensionList.Where(x => x.sName.Equals("Width")).Select(x => x.dValue).First();
|
||||
//double widthVal = oldDimensionList.Where(x => x.sName.Equals("Width")).Select(x => x.dValue).First();
|
||||
double widthVal = oldDimensionList.Where(x => x.sName.Equals("Width")).Select(x => x.dDimension).First();
|
||||
// aggiungo Dimensioni
|
||||
switch (SelShape)
|
||||
{
|
||||
@@ -100,7 +153,9 @@ namespace WebWindowTest.Models
|
||||
case Shapes.ARC_FULL:
|
||||
{
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1800, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1400, true));
|
||||
foreach (var dim in DimensionList)
|
||||
SearchAreaList(this, dim.dDimension, dim.sName);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -109,6 +164,8 @@ namespace WebWindowTest.Models
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Left Height", 1800, true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Right Height", 1500, true));
|
||||
SearchAreaList(this, widthVal, "Width");
|
||||
SearchAreaList(this, 1800, "Left Height");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -117,6 +174,8 @@ namespace WebWindowTest.Models
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Left Height", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Right Height", 1800, true));
|
||||
SearchAreaList(this, widthVal, "Width");
|
||||
SearchAreaList(this, 1800, "Right Height");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -124,16 +183,20 @@ namespace WebWindowTest.Models
|
||||
case Shapes.ARC:
|
||||
{
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1800 - (0.4 * widthVal), true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Full Height", 1800, true));
|
||||
SearchAreaList(this, widthVal, "Width");
|
||||
SearchAreaList(this, 1800, "Full Height");
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.DOUBLEARC:
|
||||
{
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 2400 - (0.6 * widthVal), true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Full Height", 2400, true));
|
||||
SearchAreaList(this, widthVal, "Width");
|
||||
SearchAreaList(this, 2400, "Full Height");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -143,6 +206,8 @@ namespace WebWindowTest.Models
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 2400 - (0.4 * widthVal), true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Full Height", 2400, true));
|
||||
DimensionList.Add(new FrameDimension(this, 4, "Radius", 200, true));
|
||||
SearchAreaList(this, 2000, "Width");
|
||||
SearchAreaList(this, 2400, "Full Height");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -151,6 +216,8 @@ namespace WebWindowTest.Models
|
||||
DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true));
|
||||
DimensionList.Add(new FrameDimension(this, 2, "Height", 1500, true));
|
||||
DimensionList.Add(new FrameDimension(this, 3, "Height projection", 0, true));
|
||||
SearchAreaList(this, widthVal, "Width");
|
||||
SearchAreaList(this, 1500, "Height");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -162,6 +229,9 @@ namespace WebWindowTest.Models
|
||||
}
|
||||
// salvo tipo Joint
|
||||
List<Joint> oldJointType = new List<Joint>(JointList);
|
||||
// salvo la lista di sash
|
||||
List<Sash> sashList = new List<Sash>();
|
||||
SearchSash(sashList, this);
|
||||
// aggiungo Joint
|
||||
m_JointList.Clear();
|
||||
switch (SelShape)
|
||||
@@ -170,25 +240,20 @@ namespace WebWindowTest.Models
|
||||
case Shapes.RIGHTCHAMFER:
|
||||
case Shapes.LEFTCHAMFER:
|
||||
case Shapes.DOUBLECHAMFER:
|
||||
case Shapes.ARC:
|
||||
case Shapes.DOUBLEARC:
|
||||
{
|
||||
JointList.Add(new Joint(this, 1, oldJointType[0].SelJointType));
|
||||
JointList.Add(new Joint(this, 2, oldJointType[1].SelJointType));
|
||||
JointList.Add(new Joint(this, 3, oldJointType[2].SelJointType));
|
||||
JointList.Add(new Joint(this, 4, oldJointType[3].SelJointType));
|
||||
if (oldJointType.Count > 3)
|
||||
JointList.Add(new Joint(this, 4, oldJointType[3].SelJointType));
|
||||
else
|
||||
JointList.Add(new Joint(this, 4, Joints.FULL_V));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.ARC:
|
||||
case Shapes.ARC_FULL:
|
||||
{
|
||||
JointList.Add(new Joint(this, 1, oldJointType[0].SelJointType));
|
||||
JointList.Add(new Joint(this, 2, oldJointType[1].SelJointType));
|
||||
JointList.Add(new Joint(this, 3, Joints.ANGLED));
|
||||
JointList.Add(new Joint(this, 4, Joints.ANGLED));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.DOUBLEARC:
|
||||
case Shapes.THREECENTERARC:
|
||||
{
|
||||
JointList.Add(new Joint(this, 1, oldJointType[0].SelJointType));
|
||||
@@ -197,26 +262,76 @@ namespace WebWindowTest.Models
|
||||
JointList.Add(new Joint(this, 4, Joints.ANGLED));
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.TRIANGLE:
|
||||
{
|
||||
JointList.Add(new Joint(this, 1, oldJointType[0].SelJointType));
|
||||
JointList.Add(new Joint(this, 2, oldJointType[1].SelJointType));
|
||||
JointList.Add(new Joint(this, 3, Joints.ANGLED));
|
||||
foreach (var s in sashList)
|
||||
{
|
||||
foreach (var sashDim in s.SashList)
|
||||
{
|
||||
sashDim.JointList.RemoveAt(sashDim.JointList.Count - 1);
|
||||
sashDim.JointList.Last().SelJointType = Joints.ANGLED;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case Shapes.CUSTOM:
|
||||
{
|
||||
JointList.Clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (JointList.Count > 3)
|
||||
{
|
||||
foreach (var s in sashList)
|
||||
{
|
||||
foreach (var sashDim in s.SashList)
|
||||
{
|
||||
if (sashDim.JointList.Count == 3)
|
||||
sashDim.JointList.Add(new Joint(s, 4, Joints.FULL_V));
|
||||
}
|
||||
}
|
||||
}
|
||||
//switch (SelShape)
|
||||
//{
|
||||
// case Shapes.RECTANGLE:
|
||||
// case Shapes.RIGHTCHAMFER:
|
||||
// case Shapes.LEFTCHAMFER:
|
||||
// case Shapes.DOUBLECHAMFER:
|
||||
// case Shapes.TRIANGLE:
|
||||
// {
|
||||
// FrameArcElem = null;
|
||||
// foreach (var s in sashList)
|
||||
// s.SashArcElem = null;
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
m_Shape = SelShape;
|
||||
}
|
||||
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
protected List<Sash> SearchSash(List<Sash> sashList, Area node)
|
||||
{
|
||||
if (node != null)
|
||||
{
|
||||
if (node.AreaType.Equals(AreaTypes.SASH))
|
||||
{
|
||||
sashList.Add((Sash)node);
|
||||
//Sash s = (Sash)node;
|
||||
//s.SashArcElem = null;
|
||||
}
|
||||
foreach (var item in node.AreaList)
|
||||
{
|
||||
SearchSash(sashList, item);
|
||||
}
|
||||
}
|
||||
return sashList;
|
||||
}
|
||||
|
||||
public Shapes Shape
|
||||
{
|
||||
get
|
||||
@@ -237,6 +352,37 @@ namespace WebWindowTest.Models
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void RefreshThresholdList()
|
||||
{
|
||||
m_ThresholdList.Clear();
|
||||
m_ThresholdList = m_AllThresholdList.GetValueOrDefault(ParentWindow.sProfilePath);
|
||||
}
|
||||
|
||||
public double HeightFrame()
|
||||
{
|
||||
switch (SelShapeIndex)
|
||||
{
|
||||
case (int)Shapes.RECTANGLE:
|
||||
case (int)Shapes.TRIANGLE:
|
||||
case (int)Shapes.ARC_FULL:
|
||||
{
|
||||
return DimensionList.Where(x => x.sName == "Height").First().dDimension;
|
||||
}
|
||||
case (int)Shapes.RIGHTCHAMFER:
|
||||
{
|
||||
return DimensionList.Where(x => x.sName == "Left Height").First().dDimension;
|
||||
}
|
||||
case (int)Shapes.LEFTCHAMFER:
|
||||
{
|
||||
return DimensionList.Where(x => x.sName == "Right Height").First().dDimension;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return DimensionList.Where(x => x.sName == "Full Height").First().dDimension;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override Frame Copy(Area ParentArea)
|
||||
{
|
||||
return null;
|
||||
@@ -246,14 +392,25 @@ namespace WebWindowTest.Models
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
//internal void SetFrameArcElem(FrameArcElement arcElement)
|
||||
//{
|
||||
// m_FrameArcElem = arcElement;
|
||||
//}
|
||||
|
||||
internal static Area CreateFrame(Window Window)
|
||||
{
|
||||
Frame NewFrame = new Frame(null, Window);
|
||||
NewFrame.SetAreaType(AreaTypes.FRAME);
|
||||
NewFrame.SetSelShape(Shapes.RECTANGLE);
|
||||
NewFrame.SetBottomRail(false);
|
||||
NewFrame.SetBottomRailQty(0);
|
||||
return NewFrame;
|
||||
Frame newFrame = new Frame(null, Window);
|
||||
newFrame.SetAreaType(AreaTypes.FRAME);
|
||||
newFrame.SetSelShape(Shapes.RECTANGLE);
|
||||
newFrame.SetBottomRail(false);
|
||||
newFrame.SetBottomRailQty(0);
|
||||
newFrame.RefreshThresholdList();
|
||||
if (m_AllThresholdList != null && m_AllThresholdList.Any())
|
||||
{
|
||||
newFrame.SetSelThresholdFromName(m_AllThresholdList.GetValueOrDefault(Window.sProfilePath)?.FirstOrDefault()?.Name ?? "");
|
||||
}
|
||||
//newFrame.FrameArcElem = null;
|
||||
return newFrame;
|
||||
}
|
||||
|
||||
internal override JsonArea Serialize(bool hideHw)
|
||||
@@ -261,7 +418,11 @@ namespace WebWindowTest.Models
|
||||
Area.nCounterGroup = 0;
|
||||
if (nCounterGroup < GroupId)
|
||||
Area.nCounterGroup = GroupId;
|
||||
JsonFrame JsonFrame = new JsonFrame(m_Shape, m_bBottomRail, m_nBottomRailQty, GroupId);
|
||||
JsonFrame JsonFrame = new JsonFrame(m_Shape, m_SelThreshold.Name, m_bBottomRail, m_nBottomRailQty, GroupId);
|
||||
//if (FrameArcElem != null)
|
||||
// JsonFrame.ArcElement = FrameArcElem.Serialize();
|
||||
//else
|
||||
// JsonFrame.ArcElement = null;
|
||||
foreach (var Dimension in DimensionList)
|
||||
JsonFrame.DimensionList.Add(Dimension.Serialize());
|
||||
foreach (var Joint in JointList)
|
||||
@@ -396,12 +557,31 @@ namespace WebWindowTest.Models
|
||||
m_Shape = Value;
|
||||
}
|
||||
|
||||
internal void SetSelThresholdFromName(string? value)
|
||||
{
|
||||
// verifica ci sia un valore...
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
m_SelThreshold = m_ThresholdList.Where(x => x.Name.Equals(value)).First();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SelThreshold = m_ThresholdList.FirstOrDefault() ?? new Threshold(1, "Bottom");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
//private FrameArcElement m_FrameArcElem = new FrameArcElement();
|
||||
|
||||
private bool m_bBottomRail;
|
||||
|
||||
private Threshold m_SelThreshold;
|
||||
|
||||
private List<Threshold> m_ThresholdList = new List<Threshold>();
|
||||
|
||||
private List<FrameDimension> m_DimensionList = new List<FrameDimension>();
|
||||
|
||||
private List<Joint> m_JointList = new List<Joint>();
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using WebWindowTest.Json;
|
||||
using static WebWindowTest.Json.WindowConst;
|
||||
|
||||
namespace WebWindowTest.Models
|
||||
{
|
||||
public class FrameArcElement
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public FrameArcElement() { }
|
||||
|
||||
public FrameArcElement(Area ParentArea, Window ParentWindow, double nSection, bool bCutEdge, bool bIsAlign)
|
||||
{
|
||||
m_ParentArea = ParentArea;
|
||||
m_ParentWindow = ParentWindow;
|
||||
m_nSection = nSection;
|
||||
m_bCutEdge = bCutEdge;
|
||||
m_bIsAlign = bIsAlign;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public int nQty
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_nQty;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_nQty = value;
|
||||
}
|
||||
}
|
||||
|
||||
public double nSection
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_nSection;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_nSection = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool bCutEdge
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_bCutEdge;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_bCutEdge = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool bIsAlign
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_bIsAlign;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_bIsAlign = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
internal void SetQty(int Qty)
|
||||
{
|
||||
m_nQty = Qty;
|
||||
}
|
||||
|
||||
internal void SetSection(double Section)
|
||||
{
|
||||
m_nSection = Section;
|
||||
}
|
||||
|
||||
//internal JsonFrameArcElement Serialize()
|
||||
//{
|
||||
// JsonFrameArcElement jArcElement = new JsonFrameArcElement(nSection, bCutEdge, bIsAlign);
|
||||
// return jArcElement;
|
||||
//}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected Area m_ParentArea;
|
||||
protected Window m_ParentWindow;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private double m_nSection;
|
||||
|
||||
private int m_nQty;
|
||||
|
||||
private bool m_bCutEdge = false;
|
||||
|
||||
private bool m_bIsAlign = false;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WebWindowTest.Json;
|
||||
using static WebWindowTest.Json.WindowConst;
|
||||
|
||||
namespace WebWindowTest.Models
|
||||
{
|
||||
public class FrameDimension
|
||||
public class FrameDimension:AreaDimension
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public FrameDimension(Frame ParentFrame, int nIndex, string sName, double dValue, bool bIsLen)
|
||||
public FrameDimension(Frame ParentFrame, int nIndex, string sName, double dDimension, bool bIsLen) : base(dDimension, MeasureTypes.ABSOLUTE)
|
||||
{
|
||||
m_ParentFrame = ParentFrame;
|
||||
m_nIndex = nIndex;
|
||||
m_sName = sName;
|
||||
m_dValue = dValue;
|
||||
m_bIsLen = bIsLen;
|
||||
}
|
||||
|
||||
@@ -24,24 +25,109 @@ namespace WebWindowTest.Models
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public double dValue
|
||||
public override double dDimension
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_dValue;
|
||||
return m_dDimension;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_dValue = value;
|
||||
if (value > MaxDim)
|
||||
if(dDimension != value)
|
||||
{
|
||||
m_dValue = MaxDim;
|
||||
if (ParentFrame.SelShapeIndex == (int)Shapes.RECTANGLE ||
|
||||
ParentFrame.SelShapeIndex == (int)Shapes.RIGHTCHAMFER ||
|
||||
ParentFrame.SelShapeIndex == (int)Shapes.LEFTCHAMFER ||
|
||||
ParentFrame.SelShapeIndex == (int)Shapes.DOUBLECHAMFER ||
|
||||
ParentFrame.SelShapeIndex == (int)Shapes.TRIANGLE)
|
||||
{
|
||||
if (value > MaxDim)
|
||||
{
|
||||
m_dDimension = MaxDim;
|
||||
}
|
||||
else if (value < MinDim && !m_sName.Equals("Radius") && !m_sName.Equals("Height projection"))
|
||||
{
|
||||
m_dDimension = MinDim;
|
||||
}
|
||||
else
|
||||
m_dDimension = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
var widthArea = (ParentFrame.DimensionList.First(x => x.sName.Equals("Width"))).m_dDimension;
|
||||
if (ParentFrame.SelShapeIndex == (int)Shapes.ARC_FULL)
|
||||
{
|
||||
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).m_dDimension;
|
||||
if (sName.Equals("Height") && value > 0.5 * widthArea && value < MaxDim)
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Width") && height > 0.5 * value && value > MinDim)
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
}
|
||||
else if (ParentFrame.SelShapeIndex == (int)Shapes.ARC)
|
||||
{
|
||||
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).m_dDimension;
|
||||
var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).m_dDimension;
|
||||
if (sName.Equals("Full Height") && (value - height) < 0.5 * widthArea && value < MaxDim)
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * widthArea && value < MaxDim)
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Width") && (fullHeight - height) < 0.5 * value && value < MaxDim)
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
}
|
||||
else if (ParentFrame.SelShapeIndex == (int)Shapes.THREECENTERARC)
|
||||
{
|
||||
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).m_dDimension;
|
||||
var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).m_dDimension;
|
||||
if (sName.Equals("Full Height") && (value - height) < 0.5 * widthArea && value < MaxDim)
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * widthArea && value < MaxDim)
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Width") && (fullHeight - height) < 0.5 * value)
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Radius") && value < 0.5 * widthArea)
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
}
|
||||
else if (ParentFrame.SelShapeIndex == (int)Shapes.DOUBLEARC)
|
||||
{
|
||||
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).m_dDimension;
|
||||
var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).m_dDimension;
|
||||
if (sName.Equals("Full Height") && (value - height) > 0.5 * widthArea && value < MaxDim)
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Height") && (fullHeight - value) > 0.5 * widthArea && value < MaxDim)
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
else if (sName.Equals("Width") && (fullHeight - height) > 0.5 * value && value > MinDim)
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ParentFrame.AreaList.Count > 0 && sName.Equals("Width"))
|
||||
ParentFrame.SearchAreaList(ParentFrame, dDimension, "Width");
|
||||
else
|
||||
ParentFrame.SearchAreaList(ParentFrame, dDimension, "Height");
|
||||
}
|
||||
else if (value < MinDim && !m_sName.Equals("Radius"))
|
||||
{
|
||||
m_dValue = MinDim;
|
||||
}
|
||||
m_ParentFrame.ParentWindow.OnUpdatePreview(m_ParentFrame.ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +161,7 @@ namespace WebWindowTest.Models
|
||||
|
||||
internal JsonFrameDimension Serialize()
|
||||
{
|
||||
JsonFrameDimension JsonFrameDimension = new JsonFrameDimension(m_nIndex, m_sName, m_dValue);
|
||||
JsonFrameDimension JsonFrameDimension = new JsonFrameDimension(m_nIndex, m_sName, m_dDimension);
|
||||
return JsonFrameDimension;
|
||||
}
|
||||
|
||||
@@ -91,7 +177,7 @@ namespace WebWindowTest.Models
|
||||
|
||||
private bool m_bIsLen = false;
|
||||
|
||||
private double m_dValue;
|
||||
//private double m_dDimension;
|
||||
|
||||
private int m_nIndex;
|
||||
|
||||
|
||||
@@ -63,14 +63,11 @@ namespace WebWindowTest.Models
|
||||
{
|
||||
get
|
||||
{
|
||||
//return IdNameStruct.IndFromId((int)m_SelJointType, m_JointTypeList);
|
||||
return (int)m_SelJointType;
|
||||
}
|
||||
set
|
||||
{
|
||||
//m_SelJointType = (Joints)IdNameStruct.IdFromInd(value, m_JointTypeList);
|
||||
m_SelJointType = (Joints)value;
|
||||
m_ParentArea.ParentWindow.OnUpdatePreview(m_ParentArea.ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebWindowTest.Models
|
||||
{
|
||||
public partial class ParametriOpzioni
|
||||
{
|
||||
private ParametriOpzioniParametri[] itemsField;
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlElement("Parametri", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
|
||||
public ParametriOpzioniParametri[] Items
|
||||
{
|
||||
get
|
||||
{
|
||||
return itemsField;
|
||||
}
|
||||
set
|
||||
{
|
||||
itemsField = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ParametriOpzioniParametri
|
||||
{
|
||||
private string nomeParametroField;
|
||||
|
||||
private string descrizioneParametroField;
|
||||
|
||||
private string valoreCorrenteField;
|
||||
|
||||
private string tipoField;
|
||||
|
||||
private string visibleField;
|
||||
|
||||
private string ricalcolaSeModificatoField;
|
||||
|
||||
private ParametriOpzioniParametriOpzioni[] opzioniField;
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
|
||||
public string NomeParametro
|
||||
{
|
||||
get
|
||||
{
|
||||
return nomeParametroField;
|
||||
}
|
||||
set
|
||||
{
|
||||
nomeParametroField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
|
||||
public string DescrizioneParametro
|
||||
{
|
||||
get
|
||||
{
|
||||
return descrizioneParametroField;
|
||||
}
|
||||
set
|
||||
{
|
||||
descrizioneParametroField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
|
||||
public string ValoreCorrente
|
||||
{
|
||||
get
|
||||
{
|
||||
return valoreCorrenteField;
|
||||
}
|
||||
set
|
||||
{
|
||||
valoreCorrenteField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
|
||||
public string Tipo
|
||||
{
|
||||
get
|
||||
{
|
||||
return tipoField;
|
||||
}
|
||||
set
|
||||
{
|
||||
tipoField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
|
||||
public string Visible
|
||||
{
|
||||
get
|
||||
{
|
||||
return visibleField;
|
||||
}
|
||||
set
|
||||
{
|
||||
visibleField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
|
||||
public string RicalcolaSeModificato
|
||||
{
|
||||
get
|
||||
{
|
||||
return ricalcolaSeModificatoField;
|
||||
}
|
||||
set
|
||||
{
|
||||
ricalcolaSeModificatoField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlElement("Opzioni", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
|
||||
public ParametriOpzioniParametriOpzioni[] Opzioni
|
||||
{
|
||||
get
|
||||
{
|
||||
return opzioniField;
|
||||
}
|
||||
set
|
||||
{
|
||||
opzioniField = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ParametriOpzioniParametriOpzioni
|
||||
{
|
||||
private string nomeParametroField;
|
||||
|
||||
private string descrizioneOpzioneField;
|
||||
|
||||
private string valoreField;
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
|
||||
public string NomeParametro
|
||||
{
|
||||
get
|
||||
{
|
||||
return nomeParametroField;
|
||||
}
|
||||
set
|
||||
{
|
||||
nomeParametroField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
|
||||
public string DescrizioneOpzione
|
||||
{
|
||||
get
|
||||
{
|
||||
return descrizioneOpzioneField;
|
||||
}
|
||||
set
|
||||
{
|
||||
descrizioneOpzioneField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
|
||||
public string Valore
|
||||
{
|
||||
get
|
||||
{
|
||||
return valoreField;
|
||||
}
|
||||
set
|
||||
{
|
||||
valoreField = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+128
-131
@@ -19,7 +19,7 @@ namespace WebWindowTest.Models
|
||||
// Lista hardware completa passata dal chiamante del componente
|
||||
public static List<Hardware> m_HardwareCompleteList = new List<Hardware>();
|
||||
|
||||
// Lista hardware completa passata dal chiamante del componente
|
||||
// Lista famiglia hardware completa passata dal chiamante del componente
|
||||
public static List<string> s_FamilyHardwareList = new List<string>();
|
||||
|
||||
#endregion Public Fields
|
||||
@@ -34,26 +34,6 @@ namespace WebWindowTest.Models
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public bool bIsMeasureGlass
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_bIsMeasureGlass;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_bIsMeasureGlass = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool bIsPercentage
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_bIsPercentage;
|
||||
}
|
||||
}
|
||||
|
||||
public bool bIsSashVertical
|
||||
{
|
||||
get
|
||||
@@ -66,6 +46,18 @@ namespace WebWindowTest.Models
|
||||
}
|
||||
}
|
||||
|
||||
//public SashArcElement? SashArcElem
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_SashArcElement;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_SashArcElement = value!;
|
||||
// }
|
||||
//}
|
||||
|
||||
public List<Hardware> HardwareList
|
||||
{
|
||||
get
|
||||
@@ -90,18 +82,6 @@ namespace WebWindowTest.Models
|
||||
}
|
||||
}
|
||||
|
||||
public List<Joint> JointList
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_JointList;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_JointList = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int nSashQty
|
||||
{
|
||||
get
|
||||
@@ -110,17 +90,20 @@ namespace WebWindowTest.Models
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value >= 0 && value <= 3)
|
||||
if (value > 0 && value <= 3)
|
||||
{
|
||||
double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
if (value > m_SashList.Count)
|
||||
{
|
||||
// recupero larghezza ultimo
|
||||
double dLastDimension = 100;
|
||||
double dNewDimension = 100;
|
||||
double dLastDimension = widthTot;
|
||||
double dNewDimension = widthTot;
|
||||
if (m_SashList.Count > 0)
|
||||
{
|
||||
dLastDimension = m_SashList[m_SashList.Count - 1].dDimension;
|
||||
dNewDimension = dLastDimension / (value + 1 - nSashQty);
|
||||
if (m_SashList[m_SashList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
dNewDimension = 1;
|
||||
m_SashList[m_SashList.Count - 1].SetDimension(dNewDimension);
|
||||
}
|
||||
else
|
||||
@@ -128,7 +111,12 @@ namespace WebWindowTest.Models
|
||||
// aggiungo area Sash di default
|
||||
for (var SplitIndex = m_SashList.Count; SplitIndex <= value - 1; SplitIndex++)
|
||||
{
|
||||
SashList.Add(new SashDimension(dNewDimension, true, this, SplitIndex + 1));
|
||||
var addSashDim = new SashDimension(dNewDimension, m_SashList[m_SashList.Count - 1].MeasureType, this, SplitIndex + 1);
|
||||
for(int i = 1; i <= 4; i++)
|
||||
{
|
||||
addSashDim.JointList.Add(new Joint(this, i, Joints.FULL_V));
|
||||
}
|
||||
SashList.Add(addSashDim);
|
||||
}
|
||||
}
|
||||
else if (value < m_SashList.Count)
|
||||
@@ -136,12 +124,29 @@ namespace WebWindowTest.Models
|
||||
if (value > 0)
|
||||
{
|
||||
double dLastDimension = 0;
|
||||
SashDimension itemDelete = null;
|
||||
double deleteDim;
|
||||
for (var SplitIndex = m_SashList.Count - 1; SplitIndex >= value; SplitIndex += -1)
|
||||
{
|
||||
dLastDimension += m_SashList[SplitIndex].dDimension;
|
||||
//dLastDimension += m_SashList[SplitIndex].dDimension;
|
||||
itemDelete = m_SashList[SplitIndex];
|
||||
SashList.RemoveAt(SplitIndex);
|
||||
}
|
||||
dLastDimension += m_SashList[SashList.Count - 1].dDimension;
|
||||
if (!itemDelete.SelMeasureType.Equals(m_SashList[SashList.Count - 1].SelMeasureType))
|
||||
{
|
||||
AreaDimension ad = new AreaDimension(itemDelete.dDimension, itemDelete.SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
deleteDim = ad.ConvertDimension(adList, itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, widthTot, m_SashList.IndexOf(itemDelete));
|
||||
}
|
||||
//deleteDim = Convert.ConvertDimension(itemDelete, itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, itemDelete.dDimension, widthTot);
|
||||
else
|
||||
deleteDim = itemDelete.dDimension;
|
||||
//dLastDimension += m_SashList[SashList.Count - 1].dDimension;
|
||||
dLastDimension = deleteDim + m_SashList[SashList.Count - 1].dDimension;
|
||||
SashList[SashList.Count - 1].SetDimension(dLastDimension);
|
||||
if (value == 1)
|
||||
SashList.First().SetHasHandle(true);
|
||||
@@ -219,13 +224,12 @@ namespace WebWindowTest.Models
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < AreaList.Count; i++)
|
||||
AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), SashList.ElementAt(i).dDimension, "Width");
|
||||
}
|
||||
RefreshHardwareList();
|
||||
RefreshHardwareOptionList();
|
||||
ClearHardwareOptionList();
|
||||
SetFirstHardware();
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
ReqRefreshHwOption();
|
||||
//m_ParentWindow.OnReqHwOptionPreview(m_ParentWindow.sSerialized(), GroupId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,7 +269,6 @@ namespace WebWindowTest.Models
|
||||
}
|
||||
set
|
||||
{
|
||||
// Controllo che il valore inserito sia positivo
|
||||
if (value >= 0)
|
||||
{
|
||||
m_nSashBottomRailQty = value;
|
||||
@@ -277,7 +280,6 @@ namespace WebWindowTest.Models
|
||||
{
|
||||
m_bSashBottomRail = false;
|
||||
}
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -315,7 +317,6 @@ namespace WebWindowTest.Models
|
||||
set
|
||||
{
|
||||
SetSelFamilyHardware(value);
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,7 +329,10 @@ namespace WebWindowTest.Models
|
||||
set
|
||||
{
|
||||
m_SelHardware = value;
|
||||
ReqRefreshHwOption();
|
||||
if (HwOptionList.Count != 0)
|
||||
{
|
||||
ClearHardwareOptionList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,13 +345,19 @@ namespace WebWindowTest.Models
|
||||
set
|
||||
{
|
||||
m_SelHardware = m_HardwareList.FirstOrDefault(x => !string.IsNullOrEmpty(value) && x.Id.Equals(value)) ?? new Hardware(CustomHwId, "", "", Enums.OpeningTypes.Null, "", 0, 0);
|
||||
HwOptionList.Clear();
|
||||
if (SelHardware.Id == CustomHwId)
|
||||
{
|
||||
HwOptionList.Clear();
|
||||
SelHwOptionList.Clear();
|
||||
}
|
||||
//ReqRefreshHwOption();
|
||||
//ParentWindow.OnUpdatePreview(ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
public string GetHardwareDescription
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SelHardware.Description;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,12 +377,10 @@ namespace WebWindowTest.Models
|
||||
{
|
||||
get
|
||||
{
|
||||
//return IdNameStruct.IndFromId((int)m_SelOrientationSashType, m_OrientationSashTypeList);
|
||||
return (int)m_SelOrientationSashType;
|
||||
}
|
||||
set
|
||||
{
|
||||
//m_SelOrientationSashType = (OrientationSash)IdNameStruct.IdFromInd(value, m_OrientationSashTypeList);
|
||||
m_SelOrientationSashType = (OrientationSash)value;
|
||||
if (value == 0)
|
||||
{
|
||||
@@ -382,7 +390,6 @@ namespace WebWindowTest.Models
|
||||
{
|
||||
m_bIsSashVertical = false;
|
||||
}
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,10 +414,6 @@ namespace WebWindowTest.Models
|
||||
newSash.SetIsSashVertical(bIsSashVertical);
|
||||
newSash.SetOrientationSashType(OrientationSashType);
|
||||
newSash.SetSashBottomRailQty(SashBottomRailQty);
|
||||
newSash.SetSelFamilyHardwareFromIndex(m_SelHardware.Id);
|
||||
newSash.ReqRefreshShape();
|
||||
newSash.RefreshHardwareOptionList();
|
||||
newSash.SetSelHardware(m_SelHardware);
|
||||
for (int i = 0; i < SashList.Count; i++)
|
||||
{
|
||||
//Cancello SashDimension di default e aggiungo la copia
|
||||
@@ -418,16 +421,20 @@ namespace WebWindowTest.Models
|
||||
SashDimension newSashDim = SashList[i].Copy();
|
||||
newSash.SashList.Insert(i, newSashDim);
|
||||
}
|
||||
foreach (var item in JointList)
|
||||
{
|
||||
Joint newJoint = item.Copy();
|
||||
newSash.JointList.Add(newJoint);
|
||||
}
|
||||
foreach (var item in AreaList)
|
||||
{
|
||||
Area newArea = item.Copy(newSash);
|
||||
newSash.AreaList.Add(newArea);
|
||||
}
|
||||
newSash.SetSelFamilyHardwareFromIndex(m_SelHardware.Id);
|
||||
newSash.SetSelHardwareFromId(CustomHwId);
|
||||
//if (ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.ARC ||
|
||||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.DOUBLEARC ||
|
||||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.ARC_FULL ||
|
||||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.THREECENTERARC)
|
||||
// newSash.SashArcElem = new SashArcElement(newSash, ParentWindow, 10, true);
|
||||
//else
|
||||
// newSash.SashArcElem = null;
|
||||
return newSash;
|
||||
}
|
||||
|
||||
@@ -440,6 +447,11 @@ namespace WebWindowTest.Models
|
||||
{
|
||||
m_HardwareList.Clear();
|
||||
Enums.OpeningTypes sOpeningType = ConvertOpeningType();
|
||||
if (string.IsNullOrEmpty(m_SelFamilyHardware))
|
||||
m_SelFamilyHardware = s_FamilyHardwareList.FirstOrDefault();
|
||||
int sashPosition = 1;
|
||||
if (nSashQty > 2 && !(SashList.First().bHasHandle || SashList.Last().bHasHandle))
|
||||
sashPosition = 2;
|
||||
var iComp = StringComparison.InvariantCultureIgnoreCase;
|
||||
var rawList = m_HardwareCompleteList
|
||||
.Where(x => x.Id == "000000" ||
|
||||
@@ -447,53 +459,28 @@ namespace WebWindowTest.Models
|
||||
x.FamilyName.Equals(m_SelFamilyHardware, iComp) &&
|
||||
x.SashQty == nSashQty &&
|
||||
x.Shape.Equals(m_CurrShape, iComp) &&
|
||||
x.OpeningType == sOpeningType)
|
||||
x.OpeningType == sOpeningType &&
|
||||
x.SashPosition == sashPosition)
|
||||
)
|
||||
.ToList() ?? new List<Hardware>();
|
||||
if(rawList.Count == 0 || rawList == null)
|
||||
{
|
||||
Hardware hw = new Hardware(CustomHwId, m_SelFamilyHardware, "Custom", sOpeningType, m_CurrShape, nSashQty, 1);
|
||||
rawList.Add(hw);
|
||||
}
|
||||
m_HardwareList = new List<Hardware>(rawList);
|
||||
//if (rawList != null && rawList.Count > 0)
|
||||
//{
|
||||
// m_HardwareList = new List<Hardware>(rawList);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// m_HardwareList = new List<Hardware>();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per rimuovere l'intero sash group
|
||||
/// </summary>
|
||||
public void Remove()
|
||||
{
|
||||
ParentArea.AreaList.Remove(this);
|
||||
Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS);
|
||||
newFill.SetAreaType(AreaTypes.FILL);
|
||||
ParentArea.AreaList.Add(newFill);
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Richiesta calcolo shape corrente
|
||||
/// </summary>
|
||||
public void ReqRefreshShape()
|
||||
{
|
||||
if (m_HardwareCompleteList != null && m_HardwareCompleteList.Count > 0)
|
||||
{
|
||||
m_HardwareList.Clear();
|
||||
// reset shape corrente
|
||||
m_CurrShape = "";
|
||||
// chiamata evento calcolo shape: gruppo da calcolare
|
||||
m_ParentWindow.OnReqShapePreview(m_ParentWindow.sSerialized(), GroupId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Richiesta calcolo hardware option list
|
||||
/// </summary>
|
||||
public void ReqRefreshHwOption()
|
||||
{
|
||||
HwOptionList.Clear();
|
||||
// chiamata evento calcolo opzioni hardware
|
||||
m_ParentWindow.OnReqHwOptionPreview(m_ParentWindow.sSerialized(), GroupId);
|
||||
}
|
||||
|
||||
public void SetSelFamilyHardware(string sFamilyHw)
|
||||
@@ -505,6 +492,8 @@ namespace WebWindowTest.Models
|
||||
RefreshHardwareList();
|
||||
}
|
||||
SetFirstHardware();
|
||||
if (HwOptionList.Count != 0)
|
||||
ClearHardwareOptionList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -514,43 +503,43 @@ namespace WebWindowTest.Models
|
||||
public void UpdateShape(string newShape)
|
||||
{
|
||||
m_CurrShape = newShape;
|
||||
bool noHwValid = false;
|
||||
// la famiglia hw è vuota seleziono il primo hardware valido e utilizzo la sua famiglia
|
||||
if(string.IsNullOrEmpty(m_SelFamilyHardware) || m_SelFamilyHardware == "")
|
||||
{
|
||||
var listHwValid = Sash.m_HardwareCompleteList
|
||||
.Where(x => x.Shape == m_CurrShape &&
|
||||
x.SashQty == nSashQty &&
|
||||
x.OpeningType == ConvertOpeningType()
|
||||
)
|
||||
.FirstOrDefault();
|
||||
.FirstOrDefault(x => x.Shape == m_CurrShape &&
|
||||
x.SashQty == nSashQty &&
|
||||
x.OpeningType == ConvertOpeningType()
|
||||
);
|
||||
if(listHwValid == null)
|
||||
{
|
||||
noHwValid = true;
|
||||
var familyHwValid = Sash.m_HardwareCompleteList
|
||||
.Select(x => x.FamilyName)
|
||||
.First();
|
||||
SelHardwareFromId = "000000";
|
||||
ClearHardwareOptionList();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSelFamilyHardware(listHwValid.FamilyName);
|
||||
}
|
||||
if (noHwValid)
|
||||
{
|
||||
SelHardwareFromId = "000000";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshHardwareList();
|
||||
// se il vecchio hw selezionato non va più bene viene selezionato il primo della lista
|
||||
if (!HardwareList.Contains(m_SelHardware) || m_SelHardware.Shape != m_CurrShape)
|
||||
{
|
||||
SetFirstHardware();
|
||||
ClearHardwareOptionList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
|
||||
internal static Sash CreateSash(Area Area)
|
||||
{
|
||||
Sash newSash = new Sash(Area, Area.ParentWindow);
|
||||
@@ -560,13 +549,17 @@ namespace WebWindowTest.Models
|
||||
newSash.SetSashQty(1);
|
||||
newSash.SetOrientationSashType(OrientationSash.VERTICAL);
|
||||
newSash.SetIsSashVertical(true);
|
||||
for (var JointIndex = 0; JointIndex <= 3; JointIndex++)
|
||||
newSash.JointList.Add(new Joint(newSash, JointIndex + 1, Joints.FULL_H));
|
||||
foreach(var sashDim in newSash.SashList)
|
||||
{
|
||||
for (var JointIndex = 0; JointIndex <= 3; JointIndex++)
|
||||
sashDim.JointList.Add(new Joint(newSash, JointIndex + 1, Joints.FULL_V));
|
||||
}
|
||||
newSash.SetSashBottomRail(false);
|
||||
newSash.SetSashBottomRailQty(0);
|
||||
newSash.SetSelFamilyHardware(Sash.s_FamilyHardwareList.First());
|
||||
newSash.RefreshHardwareOptionList();
|
||||
newSash.ClearHardwareOptionList();
|
||||
newSash.SetFirstHardware();
|
||||
//newSash.SashArcElem = null;
|
||||
return newSash;
|
||||
}
|
||||
|
||||
@@ -650,10 +643,9 @@ namespace WebWindowTest.Models
|
||||
}
|
||||
}
|
||||
|
||||
internal void RefreshHardwareOptionList()
|
||||
internal void ClearHardwareOptionList()
|
||||
{
|
||||
m_HwOptionList.Clear();
|
||||
//ReqRefreshHwOption();
|
||||
}
|
||||
|
||||
internal override JsonArea Serialize(bool hideHw)
|
||||
@@ -664,8 +656,6 @@ namespace WebWindowTest.Models
|
||||
JsonSash JsonSash = new JsonSash(m_bIsSashVertical, m_SashType, m_bSashBottomRail, m_nSashBottomRailQty, currHwId, GroupId);
|
||||
foreach (var SashDimension in SashList)
|
||||
JsonSash.SashList.Add(SashDimension.Serialize());
|
||||
foreach (var Joint in JointList)
|
||||
JsonSash.JointList.Add(Joint.Serialize());
|
||||
if(HwOptionList.Count > 0)
|
||||
{
|
||||
foreach (var HwOption in HwOptionList)
|
||||
@@ -676,17 +666,25 @@ namespace WebWindowTest.Models
|
||||
foreach (var HwOption in SelHwOptionList)
|
||||
JsonSash.HwOptionList.Add(new JsonHwOption(HwOption.Key, HwOption.Value));
|
||||
}
|
||||
//if (SashArcElem != null)
|
||||
// JsonSash.ArcElement = SashArcElem.Serialize();
|
||||
//else
|
||||
// JsonSash.ArcElement = null;
|
||||
foreach (var Area in AreaList)
|
||||
JsonSash.AreaList.Add(Area.Serialize(hideHw));
|
||||
return JsonSash;
|
||||
}
|
||||
|
||||
//internal void SetSashArcElem(SashArcElement arcElement)
|
||||
//{
|
||||
// m_SashArcElement = arcElement;
|
||||
//}
|
||||
|
||||
internal void SetFirstHardware()
|
||||
{
|
||||
if (m_HardwareList.Count > 0)
|
||||
{
|
||||
m_SelHardware = m_HardwareList.First();
|
||||
//ReqRefreshHwOption();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,14 +748,18 @@ namespace WebWindowTest.Models
|
||||
case HwOptionTypes.COMBO:
|
||||
{
|
||||
AGBOptionCombo OptCombo = (AGBOptionCombo)HwOption;
|
||||
var selValue = OptCombo.ValueList.Where(x => x.sValue == selHwOption).First();
|
||||
OptCombo.sValue = selValue;
|
||||
var selValue = OptCombo.ValueList.Where(x => x.sValue == selHwOption).FirstOrDefault();
|
||||
if (selValue != null)
|
||||
OptCombo.sValue = selValue;
|
||||
else
|
||||
OptCombo.sValue = OptCombo.ValueList.First();
|
||||
break;
|
||||
}
|
||||
case HwOptionTypes.TEXT:
|
||||
{
|
||||
AGBOptionText OptText = (AGBOptionText)HwOption;
|
||||
OptText.sValue = selHwOption;
|
||||
if(OptText.ValueList.FirstOrDefault(x => x.Equals(selHwOption)) != null || OptText.sName.Equals("HMan"))
|
||||
OptText.sValue = selHwOption;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -804,7 +806,10 @@ namespace WebWindowTest.Models
|
||||
dNewDimension = dLastDimension / (Qty + 1 - nSashQty);
|
||||
// aggiungo area Sash di default
|
||||
for (var SplitIndex = m_SashList.Count; SplitIndex <= Qty - 1; SplitIndex++)
|
||||
SashList.Add(new SashDimension(dNewDimension, true, this, SplitIndex + 1));
|
||||
{
|
||||
SashDimension newSashDim = new SashDimension(dNewDimension, MeasureTypes.PERCENTAGE, this, SplitIndex + 1);
|
||||
SashList.Add(newSashDim);
|
||||
}
|
||||
}
|
||||
else if (Qty < m_SashList.Count)
|
||||
{
|
||||
@@ -833,11 +838,6 @@ namespace WebWindowTest.Models
|
||||
return SelFamilyHardware;
|
||||
}
|
||||
|
||||
internal void SetSelHardware(Hardware value)
|
||||
{
|
||||
SelHardware = value;
|
||||
}
|
||||
|
||||
internal void SetSelHardwareFromId(string sId)
|
||||
{
|
||||
if (m_HardwareList.Count == 0)
|
||||
@@ -864,8 +864,6 @@ namespace WebWindowTest.Models
|
||||
|
||||
private bool m_bIsMeasureGlass;
|
||||
|
||||
private bool m_bIsPercentage = true;
|
||||
|
||||
private bool m_bIsSashVertical;
|
||||
|
||||
private bool m_bSashBottomRail;
|
||||
@@ -876,8 +874,6 @@ namespace WebWindowTest.Models
|
||||
private List<AGBOption> m_HwOptionList = new List<AGBOption>();
|
||||
private Dictionary<string, string> m_SelHwOptionList = new Dictionary<string, string>();
|
||||
|
||||
private List<Joint> m_JointList = new List<Joint>();
|
||||
|
||||
private int m_nSashBottomRailQty;
|
||||
|
||||
private List<IdNameStruct> m_OrientationSashTypeList = new List<IdNameStruct>
|
||||
@@ -888,9 +884,10 @@ namespace WebWindowTest.Models
|
||||
|
||||
private List<SashDimension> m_SashList = new List<SashDimension>();
|
||||
private SashTypes m_SashType;
|
||||
private string m_SelFamilyHardware;
|
||||
private string m_SelFamilyHardware = "";
|
||||
private Hardware m_SelHardware;
|
||||
private OrientationSash m_SelOrientationSashType;
|
||||
//private SashArcElement m_SashArcElement;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using WebWindowTest.Json;
|
||||
using static WebWindowTest.Json.WindowConst;
|
||||
|
||||
namespace WebWindowTest.Models
|
||||
{
|
||||
public class SashArcElement
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SashArcElement() { }
|
||||
|
||||
public SashArcElement(Area ParentArea, Window ParentWindow, double nSection, bool bCutEdge)
|
||||
{
|
||||
m_ParentArea = ParentArea;
|
||||
m_ParentWindow = ParentWindow;
|
||||
m_nSection = nSection;
|
||||
m_bCutEdge = bCutEdge;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public int nQty
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_nQty;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_nQty = value;
|
||||
}
|
||||
}
|
||||
|
||||
public double nSection
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_nSection;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_nSection = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool bCutEdge
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_bCutEdge;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_bCutEdge = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
//internal JsonSashArcElement Serialize()
|
||||
//{
|
||||
// JsonSashArcElement jArcElement = new JsonSashArcElement(nSection, bCutEdge);
|
||||
// return jArcElement;
|
||||
//}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected Area m_ParentArea;
|
||||
protected Window m_ParentWindow;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private double m_nSection;
|
||||
|
||||
private int m_nQty;
|
||||
|
||||
private bool m_bCutEdge = false;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Principal;
|
||||
using WebWindowTest.Json;
|
||||
using static WebWindowTest.Json.WindowConst;
|
||||
|
||||
namespace WebWindowTest.Models
|
||||
{
|
||||
public class SashDimension
|
||||
public class SashDimension : AreaDimension
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SashDimension(double dDimension, bool bIsRelative, Sash Parent, int nSashId)
|
||||
public SashDimension(double dDimension, MeasureTypes MeasureType, Sash Parent, int nSashId):base(dDimension, MeasureType)
|
||||
{
|
||||
m_dDimension = dDimension;
|
||||
m_bIsRelative = bIsRelative;
|
||||
m_Parent = Parent;
|
||||
m_nSashId = nSashId;
|
||||
m_Parent = Parent;
|
||||
SetMeasureType(MeasureType);
|
||||
// assengno maniglia
|
||||
if (Parent.SashList.Count == 0 || !Parent.SashList.Any(x => x.bHasHandle))
|
||||
m_bHasHandle = true;
|
||||
@@ -106,19 +103,34 @@ namespace WebWindowTest.Models
|
||||
set
|
||||
{
|
||||
m_bHasHandle = value;
|
||||
//m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
public bool bIsRelative
|
||||
public Sash Parent
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_bIsRelative;
|
||||
return m_Parent;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Parent = value;
|
||||
}
|
||||
}
|
||||
|
||||
public double dDimension
|
||||
public List<Joint> JointList
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_JointList;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_JointList = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override double dDimension
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -126,72 +138,167 @@ namespace WebWindowTest.Models
|
||||
}
|
||||
set
|
||||
{
|
||||
// Controllo che il valore inserito sia compreso tra 0 e 100
|
||||
if (value > 0 && value < 100)
|
||||
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
double valMinAbsolute = 200;
|
||||
double valMaxAbsolute = widthTot - valMinAbsolute * (m_Parent.SashList.Count - 1);
|
||||
bool valueAccept = false;
|
||||
switch (MeasureType)
|
||||
{
|
||||
// se sono in percentuale
|
||||
if (m_bIsRelative)
|
||||
{
|
||||
// verifico se ci sono assoluti
|
||||
List<SashDimension> RelativeDimList = m_Parent.SashList.Where(x => x.bIsRelative).ToList();
|
||||
if (RelativeDimList.Count > 0)
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
if (m_Parent.bIsPercentage)
|
||||
valueAccept = (value < valMaxAbsolute && value > valMinAbsolute) ? true : false;
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
valMaxAbsolute = 20;
|
||||
valueAccept = (value >= 1) ? true : false;
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
valMaxAbsolute = valMaxAbsolute / widthTot * 100;
|
||||
valMinAbsolute = valMinAbsolute / widthTot * 100;
|
||||
valueAccept = (value < valMaxAbsolute && value > valMinAbsolute) ? true : false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (valueAccept)
|
||||
{
|
||||
List<SashDimension> dimensions = m_Parent.SashList;
|
||||
List<double> absoluteValList = new List<double>();
|
||||
AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in m_Parent.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType));
|
||||
}
|
||||
int index = 0;
|
||||
foreach (var item in m_Parent.SashList)
|
||||
{
|
||||
absoluteValList.Add(adList.ElementAt(index).CalculateAbsoluteValue(adList, widthTot));
|
||||
index++;
|
||||
}
|
||||
int nIndex = dimensions.IndexOf(this);
|
||||
int proportionalCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count;
|
||||
int percentageCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList().Count;
|
||||
// Le dimensioni sono solo in proporzionale
|
||||
if (proportionalCount == absoluteValList.Count || SelMeasureType.Equals(MeasureTypes.PROPORTIONAL) ||
|
||||
(SelMeasureType.Equals(MeasureTypes.ABSOLUTE) && proportionalCount == absoluteValList.Count -1))
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
// Le dimensioni sono solo in percentuale
|
||||
else if (percentageCount == dimensions.Count)
|
||||
{
|
||||
if (value < m_dDimension)
|
||||
{
|
||||
// L'anta modificata non è l'ultima
|
||||
if (nIndex < dimensions.Count - 1)
|
||||
dimensions[nIndex + 1].SetDimension(dimensions[nIndex + 1].m_dDimension + (m_dDimension - value));
|
||||
else if (dimensions.Count > 1)
|
||||
dimensions[nIndex - 1].SetDimension(dimensions[nIndex - 1].m_dDimension + (m_dDimension - value));
|
||||
else
|
||||
{
|
||||
int nIndex = RelativeDimList.IndexOf(this);
|
||||
// se diminuisce dimensione
|
||||
if (value < m_dDimension)
|
||||
{
|
||||
if (nIndex < RelativeDimList.Count - 1)
|
||||
RelativeDimList[nIndex + 1].SetDimension(RelativeDimList[nIndex + 1].dDimension + (m_dDimension - value));
|
||||
else if (RelativeDimList.Count > 1)
|
||||
RelativeDimList[nIndex - 1].SetDimension(RelativeDimList[nIndex - 1].dDimension + (m_dDimension - value));
|
||||
else
|
||||
{
|
||||
m_dDimension = 100;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// se aumenta dimensione
|
||||
else
|
||||
{
|
||||
double dRes = value;
|
||||
// se non ultima anta
|
||||
if (nIndex < RelativeDimList.Count - 1)
|
||||
{
|
||||
for (var nInd = 0; nInd <= nIndex - 1; nInd++)
|
||||
dRes += RelativeDimList[nInd].dDimension;
|
||||
dRes = (100 - dRes) / (RelativeDimList.Count - nIndex - 1);
|
||||
for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++)
|
||||
RelativeDimList[Ind].SetDimension(dRes);
|
||||
}
|
||||
// se ultima anta
|
||||
else if (RelativeDimList.Count > 1)
|
||||
{
|
||||
if (RelativeDimList.Count > 2)
|
||||
{
|
||||
for (var Ind = 0; Ind <= nIndex - 2; Ind++)
|
||||
dRes += RelativeDimList[Ind].dDimension;
|
||||
}
|
||||
|
||||
//for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++)
|
||||
// dRes += RelativeDimList[Ind].dDimension;
|
||||
dRes = (100 - dRes);
|
||||
RelativeDimList[nIndex - 1].SetDimension(dRes);
|
||||
//for (var nInd = 0; nInd <= nIndex - 1; nInd++)
|
||||
// RelativeDimList[nInd].SetDimension(dRes);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dDimension = 100;
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_dDimension = 100;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
double dRes = value;
|
||||
// se non ultima anta
|
||||
if (nIndex < dimensions.Count - 1)
|
||||
{
|
||||
for (var nInd = 0; nInd <= nIndex - 1; nInd++)
|
||||
dRes += dimensions[nInd].m_dDimension;
|
||||
dRes = (100 - dRes) / (dimensions.Count - nIndex - 1);
|
||||
for (var Ind = nIndex + 1; Ind <= dimensions.Count - 1; Ind++)
|
||||
dimensions[Ind].SetDimension(dRes);
|
||||
}
|
||||
// se ultima anta
|
||||
else if (dimensions.Count > 1)
|
||||
{
|
||||
if (dimensions.Count > 2)
|
||||
{
|
||||
for (var Ind = 0; Ind <= nIndex - 2; Ind++)
|
||||
dRes += dimensions[Ind].m_dDimension;
|
||||
}
|
||||
dRes = (100 - dRes);
|
||||
dimensions[nIndex - 1].SetDimension(dRes);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dDimension = 100;
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_dDimension = value;
|
||||
}
|
||||
m_dDimension = value;
|
||||
m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
|
||||
// Le dimensioni sono miste o solo in assoluto
|
||||
else
|
||||
{
|
||||
double valueInAbsolute = 0;
|
||||
switch (MeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
valueInAbsolute = value;
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
var pesi = value + dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL) && !x.Equals(this))
|
||||
.Sum(x => x.m_dDimension);
|
||||
valueInAbsolute = widthTot / pesi * value;
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
valueInAbsolute = (value / 100) * widthTot;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (value < m_dDimension)
|
||||
{
|
||||
// L'anta modificata non è l'ultima
|
||||
if (nIndex < absoluteValList.Count - 1)
|
||||
{
|
||||
absoluteValList[nIndex + 1] = absoluteValList[nIndex + 1] + (absoluteValList[nIndex] - valueInAbsolute);
|
||||
absoluteValList[nIndex] = valueInAbsolute;
|
||||
}
|
||||
// L'anta modificata è l'ultima
|
||||
else if (dimensions.Count > 1)
|
||||
{
|
||||
absoluteValList[nIndex - 1] = absoluteValList[nIndex - 1] + (absoluteValList[nIndex] - valueInAbsolute);
|
||||
absoluteValList[nIndex] = valueInAbsolute;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// L'anta modificata non è l'ultima
|
||||
if (nIndex < absoluteValList.Count - 1)
|
||||
{
|
||||
absoluteValList[nIndex + 1] = absoluteValList[nIndex + 1] - (valueInAbsolute - absoluteValList[nIndex]);
|
||||
absoluteValList[nIndex] = valueInAbsolute;
|
||||
}
|
||||
// L'anta modificata è l'ultima
|
||||
else if (dimensions.Count > 1)
|
||||
{
|
||||
absoluteValList[nIndex - 1] = absoluteValList[nIndex - 1] - (valueInAbsolute - absoluteValList[nIndex]);
|
||||
absoluteValList[nIndex] = valueInAbsolute;
|
||||
}
|
||||
}
|
||||
if (MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
m_dDimension = value;
|
||||
for (int i = 0; i < absoluteValList.Count; i++)
|
||||
{
|
||||
var item = m_Parent.SashList.ElementAt(i);
|
||||
item.SetDimension(ad.ConvertIn(adList, absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot));
|
||||
}
|
||||
}
|
||||
foreach(var item in m_Parent.AreaList)
|
||||
item.SearchAreaList(item, dDimension, "Width");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,7 +315,7 @@ namespace WebWindowTest.Models
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Openings)m_SelOpeningType;
|
||||
return m_SelOpeningType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,8 +336,7 @@ namespace WebWindowTest.Models
|
||||
set
|
||||
{
|
||||
m_SelOpeningType = value;
|
||||
m_Parent.ReqRefreshShape();
|
||||
m_Parent.RefreshHardwareOptionList();
|
||||
m_Parent.ClearHardwareOptionList();
|
||||
m_Parent.SetFirstHardware();
|
||||
}
|
||||
}
|
||||
@@ -239,22 +345,72 @@ namespace WebWindowTest.Models
|
||||
{
|
||||
get
|
||||
{
|
||||
//return IdNameStruct.IndFromId((int)m_SelOpeningType, m_OpeningTypeList);
|
||||
return (int)m_SelOpeningType;
|
||||
}
|
||||
set
|
||||
{
|
||||
//Openings newOpening = (Openings)IdNameStruct.IdFromInd(value, m_OpeningTypeList);
|
||||
Openings newOpening = (Openings)value;
|
||||
if ((newOpening != Openings.TILTTURN_LEFT && newOpening != Openings.TILTTURN_RIGHT) ||
|
||||
(newOpening == Openings.TILTTURN_LEFT && m_bHasHandle) ||
|
||||
(newOpening == Openings.TILTTURN_RIGHT && m_bHasHandle))
|
||||
{
|
||||
m_SelOpeningType = newOpening;
|
||||
m_Parent.ReqRefreshShape();
|
||||
m_Parent.RefreshHardwareOptionList();
|
||||
m_Parent.ClearHardwareOptionList();
|
||||
m_Parent.RefreshHardwareList();
|
||||
m_Parent.SetFirstHardware();
|
||||
m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//public MeasureTypes MeasureType
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_SelMeasureType;
|
||||
// }
|
||||
//}
|
||||
|
||||
//public List<IdNameStruct> MeasureTypeList
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_MeasureTypeList;
|
||||
// }
|
||||
//}
|
||||
|
||||
//public MeasureTypes SelMeasureType
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_SelMeasureType;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_SelMeasureType = value;
|
||||
// }
|
||||
//}
|
||||
|
||||
public override int SelMeasureTypeIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)SelMeasureType;
|
||||
}
|
||||
set
|
||||
{
|
||||
if(SelMeasureType != (MeasureTypes)value)
|
||||
{
|
||||
MeasureTypes newType = (MeasureTypes)value;
|
||||
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in m_Parent.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(adList, SelMeasureType, newType, widthTot, nSashId-1);
|
||||
//m_dDimension = Convert.ConvertDimension(this, m_SelMeasureType, newType, m_dDimension, widthTot);
|
||||
SelMeasureType = (MeasureTypes)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -263,11 +419,72 @@ namespace WebWindowTest.Models
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per convertire la dimensione dal vecchio tipo al nuovo tipo
|
||||
/// </summary>
|
||||
/// <param name="oldType"> Vecchio tipo </param>
|
||||
/// <param name="newType"> Nuovo tipo </param>
|
||||
/// <returns></returns>
|
||||
//public double ConvertDimension(MeasureTypes oldType, MeasureTypes newType, double widthTot)
|
||||
//{
|
||||
// switch (oldType)
|
||||
// {
|
||||
// case MeasureTypes.ABSOLUTE:
|
||||
// {
|
||||
// if (newType.Equals(MeasureTypes.PERCENTAGE))
|
||||
// {
|
||||
// //return Double.Round((m_dDimension / m_Parent.Width) * 100, 1);
|
||||
// return (m_dDimension / widthTot) * 100;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return CalculatePropVal(widthTot);
|
||||
// }
|
||||
// }
|
||||
// case MeasureTypes.PROPORTIONAL:
|
||||
// {
|
||||
// if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
// {
|
||||
// //return Double.Round(ConvertFromPropVal(newType), 2);
|
||||
// return ConvertFromPropVal(newType, widthTot, dDimension);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //return Double.Round(ConvertFromPropVal(newType), 1);
|
||||
// return ConvertFromPropVal(newType, widthTot, dDimension);
|
||||
// }
|
||||
// }
|
||||
// case MeasureTypes.PERCENTAGE:
|
||||
// {
|
||||
// if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
// {
|
||||
// //return Double.Round((m_dDimension * m_Parent.Width) / 100, 2);
|
||||
// return (m_dDimension * widthTot) / 100;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return CalculatePropVal(widthTot);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per copiare l'intero oggetto
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public SashDimension Copy()
|
||||
{
|
||||
SashDimension newSashDim = new SashDimension(dDimension, bIsRelative, m_Parent, m_nSashId);
|
||||
SashDimension newSashDim = new SashDimension(m_dDimension, MeasureType, m_Parent, m_nSashId);
|
||||
newSashDim.SetMeasureType(MeasureType);
|
||||
newSashDim.SetOpeningType(SelOpeningType);
|
||||
newSashDim.SetHasHandle(bHasHandle);
|
||||
foreach (var item in JointList)
|
||||
{
|
||||
Joint newJoint = item.Copy();
|
||||
newSashDim.JointList.Add(newJoint);
|
||||
}
|
||||
return newSashDim;
|
||||
}
|
||||
|
||||
@@ -275,16 +492,277 @@ namespace WebWindowTest.Models
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per calcolare larghezza intera sash group
|
||||
/// </summary>
|
||||
/// <param name="area"> area di partenza </param>
|
||||
/// <param name="width"> larghezza di partenza </param>
|
||||
/// <returns></returns>
|
||||
internal double CalculateWidthSashGroup(Area area, double width)
|
||||
{
|
||||
for(int i = 0; i < area.AreaList.Count; i++)
|
||||
{
|
||||
double risultato = -1;
|
||||
if (area.Equals(m_Parent))
|
||||
return width;
|
||||
Area item = area.AreaList[i];
|
||||
if (area is Split)
|
||||
{
|
||||
Split split = (Split)area;
|
||||
if (split.SplitVertList.Count > 0)
|
||||
{
|
||||
switch (split.SplitVertList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(i).dDimension, split.SplitVertList.ElementAt(i).SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach(var it in split.SplitVertList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
risultato = CalculateWidthSashGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
else
|
||||
{
|
||||
risultato = CalculateWidthSashGroup(item, width);
|
||||
}
|
||||
}
|
||||
else if (area is Sash)
|
||||
{
|
||||
Sash sash = (Sash)area;
|
||||
switch (sash.SashList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
//risultato = CalculateWidthSashGroup(item, ConvertFromPropVal(MeasureTypes.ABSOLUTE, width, sash.SashList.ElementAt(i).dDimension));
|
||||
AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in sash.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
risultato = CalculateWidthSashGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width));
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
else
|
||||
{
|
||||
risultato = CalculateWidthSashGroup(item, width);
|
||||
if (risultato != -1)
|
||||
return risultato;
|
||||
}
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Calcolo MCD
|
||||
///// </summary>
|
||||
///// <param name="a"></param>
|
||||
///// <param name="b"></param>
|
||||
///// <returns></returns>
|
||||
//internal static double CalculateMCD(double a, double b)
|
||||
//{
|
||||
// while (b >= 0.01)
|
||||
// {
|
||||
// double temp = b;
|
||||
// b = a % b;
|
||||
// a = temp;
|
||||
// }
|
||||
// //return Double.Round(a,2);
|
||||
// return a;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//internal double CalculatePropVal(double widthTot)
|
||||
//{
|
||||
// if (m_Parent.SashList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0)
|
||||
// {
|
||||
// return 1;
|
||||
// }
|
||||
// List<double> absoluteValue = new List<double>();
|
||||
// foreach (var item in m_Parent.SashList)
|
||||
// {
|
||||
// absoluteValue.Add(item.CalculateAbsoluteValue(widthTot));
|
||||
// }
|
||||
// for (int i = 0; i < m_Parent.SashList.Count; i++)
|
||||
// {
|
||||
// if (!m_Parent.SashList.ElementAt(i).Equals(this) &&
|
||||
// m_Parent.SashList.ElementAt(i).MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
// {
|
||||
// int nIndex = m_Parent.SashList.IndexOf(this);
|
||||
// if (absoluteValue.ElementAt(nIndex) <= absoluteValue.ElementAt(i))
|
||||
// {
|
||||
// var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
|
||||
// m_Parent.SashList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
|
||||
// m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
|
||||
// m_Parent.SashList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
|
||||
// m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// return m_dDimension;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Metodo per trasformare una dimensione in valore assoluto rispetto alla larghezza totale
|
||||
///// </summary>
|
||||
///// <param name="widthTot"> Larghezza totale </param>
|
||||
///// <returns></returns>
|
||||
//internal double CalculateAbsoluteValue(double widthTot)
|
||||
//{
|
||||
// switch (MeasureType)
|
||||
// {
|
||||
// case MeasureTypes.ABSOLUTE:
|
||||
// {
|
||||
// //return Double.Round(dDimension, 2);
|
||||
// return dDimension;
|
||||
// }
|
||||
// case MeasureTypes.PROPORTIONAL:
|
||||
// {
|
||||
// //return Double.Round(Proportional2AbsolutVal(), 2);
|
||||
// return ProportionalFromAbsoluteVal(widthTot);
|
||||
// }
|
||||
// case MeasureTypes.PERCENTAGE:
|
||||
// {
|
||||
// //return Double.Round((dDimension / 100) * widthTot, 1);
|
||||
// return (dDimension / 100) * widthTot;
|
||||
// }
|
||||
// }
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Metodo per convertire una dimensione da un valore assoluto al suo rispettivo tipo
|
||||
///// </summary>
|
||||
///// <param name="absoluteVal"> Valore assoluto </param>
|
||||
///// <param name="type"> Tipo di misura della dimensione </param>
|
||||
///// <param name="widthTot"> Larghezza totale </param>
|
||||
///// <returns></returns>
|
||||
//internal double ConvertIn(double absoluteVal, MeasureTypes type, double widthTot)
|
||||
//{
|
||||
// switch (type)
|
||||
// {
|
||||
// case MeasureTypes.ABSOLUTE:
|
||||
// {
|
||||
// return absoluteVal;
|
||||
// }
|
||||
// case MeasureTypes.PROPORTIONAL:
|
||||
// {
|
||||
// return ProportionalFromAbsoluteVal(widthTot);
|
||||
// }
|
||||
// case MeasureTypes.PERCENTAGE:
|
||||
// {
|
||||
// return (absoluteVal / widthTot) * 100;
|
||||
// }
|
||||
// }
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Metodo per convertire da misura proporzionale a misura assoluta o percentuale
|
||||
///// </summary>
|
||||
///// <param name="newType"></param>
|
||||
///// <returns></returns>
|
||||
//internal double ConvertFromPropVal(MeasureTypes newType, double widthTot, double dim)
|
||||
//{
|
||||
// double tot = widthTot;
|
||||
// //Somma misura non proporzionali
|
||||
// double sumNotProp = m_Parent.SashList
|
||||
// .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this))
|
||||
// .Sum(m => m.CalculateAbsoluteValue(tot));
|
||||
// //Calcolo residuo
|
||||
// double res = tot - sumNotProp;
|
||||
// if (res < 0) res = 0;
|
||||
// //Misure proporzionali
|
||||
// var proportionalList = m_Parent.SashList
|
||||
// .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
// .ToList();
|
||||
|
||||
// double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
// if (sumPesi == 0) sumPesi = 1;
|
||||
// if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
// {
|
||||
// return res / sumPesi * dim;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return (res / sumPesi * dim) / tot * 100;
|
||||
// }
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Metodo per trasformare il valore proporzionale in assoluto
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//internal double ProportionalFromAbsoluteVal(double widthTot)
|
||||
//{
|
||||
// double tot = widthTot;
|
||||
// //Somma misura non proporzionali
|
||||
// double sumNotProp = m_Parent.SashList
|
||||
// .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL)
|
||||
// .Sum(m => m.CalculateAbsoluteValue(tot));
|
||||
// //Calcolo residuo
|
||||
// double res = tot - sumNotProp;
|
||||
// if (res < 0) res = 0;
|
||||
// //Misure proporzionali
|
||||
// var proportionalList = m_Parent.SashList
|
||||
// .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
// .ToList();
|
||||
// double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
// if (sumPesi == 0) sumPesi = 1;
|
||||
// return res / sumPesi * dDimension;
|
||||
//}
|
||||
|
||||
internal JsonSashDimension Serialize()
|
||||
{
|
||||
JsonSashDimension JsonSashDimension = new JsonSashDimension(OpeningType, m_bHasHandle, m_dDimension, m_nSashId);
|
||||
JsonSashDimension JsonSashDimension = new JsonSashDimension(OpeningType, MeasureType, m_bHasHandle, dDimension, m_nSashId);
|
||||
foreach (var Joint in JointList)
|
||||
JsonSashDimension.JointList.Add(Joint.Serialize());
|
||||
return JsonSashDimension;
|
||||
}
|
||||
|
||||
internal void SetDimension(double dValue)
|
||||
{
|
||||
m_dDimension = dValue;
|
||||
}
|
||||
//internal void SetDimension(double dValue)
|
||||
//{
|
||||
// m_dDimension = dValue;
|
||||
//}
|
||||
|
||||
internal void SetHasHandle(bool value)
|
||||
{
|
||||
@@ -296,15 +774,40 @@ namespace WebWindowTest.Models
|
||||
m_SelOpeningType = value;
|
||||
}
|
||||
|
||||
internal void SetMeasureType(MeasureTypes value)
|
||||
{
|
||||
SelMeasureType = value;
|
||||
}
|
||||
|
||||
internal void SetSelMeasureType(MeasureTypes value, int indexSash)
|
||||
{
|
||||
if (SelMeasureType != (MeasureTypes)value)
|
||||
{
|
||||
MeasureTypes newType = (MeasureTypes)value;
|
||||
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
List<AreaDimension> newDimensions = new List<AreaDimension>();
|
||||
foreach(var item in m_Parent.SashList)
|
||||
{
|
||||
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(newDimensions, SelMeasureType, newType, widthTot, indexSash);
|
||||
if(newType is MeasureTypes.PROPORTIONAL)
|
||||
{
|
||||
for (int i = 0; i < newDimensions.Count; i++)
|
||||
m_Parent.SashList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
|
||||
}
|
||||
SelMeasureType = (MeasureTypes)value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool m_bHasHandle;
|
||||
|
||||
private bool m_bIsRelative = false;
|
||||
|
||||
private double m_dDimension;
|
||||
//private double m_dDimension;
|
||||
|
||||
private int m_nSashId;
|
||||
|
||||
@@ -337,11 +840,23 @@ namespace WebWindowTest.Models
|
||||
//new IdNameStruct((int)Openings.LIFTSLIDE_RIGHT, "←┐")
|
||||
};
|
||||
|
||||
//private List<IdNameStruct> m_MeasureTypeList = new List<IdNameStruct>
|
||||
//{
|
||||
// new IdNameStruct((int)MeasureTypes.ABSOLUTE, "Absolute"),
|
||||
// new IdNameStruct((int)MeasureTypes.PROPORTIONAL, "Proportional"),
|
||||
// new IdNameStruct((int)MeasureTypes.PERCENTAGE, "Percentage"),
|
||||
//};
|
||||
|
||||
// reference
|
||||
private Sash m_Parent;
|
||||
|
||||
private List<Joint> m_JointList = new List<Joint>();
|
||||
|
||||
private Openings m_SelOpeningType;
|
||||
|
||||
//private MeasureTypes m_SelMeasureType;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
}
|
||||
}
|
||||
+220
-153
@@ -20,13 +20,13 @@ namespace WebWindowTest.Models
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public bool bIsPercentage
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_bIsPercentage;
|
||||
}
|
||||
}
|
||||
//public bool bIsPercentage
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_bIsPercentage;
|
||||
// }
|
||||
//}
|
||||
|
||||
public bool bSplitStartVert
|
||||
{
|
||||
@@ -37,7 +37,6 @@ namespace WebWindowTest.Models
|
||||
set
|
||||
{
|
||||
m_bSplitStartVert = value;
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,81 +48,86 @@ namespace WebWindowTest.Models
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == 0)
|
||||
if(value >= 0 && value < 6)
|
||||
{
|
||||
for (var SplitIndex = m_SplitHorizList.Count - 1; SplitIndex >= value; SplitIndex += -1)
|
||||
m_SplitHorizList.RemoveAt(SplitIndex);
|
||||
if (nSplitQtyVert == 0)
|
||||
if (value == 0)
|
||||
{
|
||||
ParentArea.AreaList.Remove(this);
|
||||
Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS);
|
||||
newFill.SetAreaType(AreaTypes.FILL);
|
||||
ParentArea.AreaList.Add(newFill);
|
||||
}
|
||||
else
|
||||
SetSplitShape(SplitShapes.VERTICAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ricalcolo dimensioni aggiungendo split
|
||||
if (value > m_SplitHorizList.Count - 1)
|
||||
{
|
||||
// recupero larghezza ultimo
|
||||
double dLastDimension = 100;
|
||||
double dNewDimension = 100;
|
||||
if (m_SplitHorizList.Count > 0)
|
||||
for (var SplitIndex = m_SplitHorizList.Count - 1; SplitIndex >= value; SplitIndex += -1)
|
||||
m_SplitHorizList.RemoveAt(SplitIndex);
|
||||
if (nSplitQtyVert == 0)
|
||||
{
|
||||
dLastDimension = m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension;
|
||||
dNewDimension = dLastDimension / (value + 1 - nSplitQtyHoriz);
|
||||
m_SplitHorizList[m_SplitHorizList.Count - 1].SetDimension(dNewDimension);
|
||||
ParentArea.AreaList.Remove(this);
|
||||
Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS);
|
||||
newFill.SetAreaType(AreaTypes.FILL);
|
||||
ParentArea.AreaList.Add(newFill);
|
||||
}
|
||||
else
|
||||
dNewDimension = dLastDimension / (value + 1 - nSplitQtyHoriz);
|
||||
// aggiungo area Split di default
|
||||
for (var SplitIndex = m_SplitHorizList.Count; SplitIndex <= value; SplitIndex++)
|
||||
m_SplitHorizList.Add(new SplitDimension(dNewDimension, true, this, false));
|
||||
SetSplitShape(SplitShapes.VERTICAL);
|
||||
}
|
||||
// Ricalcolo dimensioni rimuovendo split
|
||||
else
|
||||
{
|
||||
double dLastDimension = 0;
|
||||
for (var SplitIndex = m_SplitHorizList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1)
|
||||
double heightTot = CalculateHeightArea(ParentWindow.AreaList.First(), HeightFrame());
|
||||
// Ricalcolo dimensioni aggiungendo split
|
||||
if (value > m_SplitHorizList.Count - 1)
|
||||
{
|
||||
dLastDimension += m_SplitHorizList[SplitIndex].dDimension;
|
||||
m_SplitHorizList.RemoveAt(SplitIndex);
|
||||
// recupero larghezza ultimo
|
||||
double dLastDimension = heightTot;
|
||||
double dNewDimension = heightTot;
|
||||
if (m_SplitHorizList.Count > 0)
|
||||
{
|
||||
dLastDimension = m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension;
|
||||
dNewDimension = dLastDimension / (value + 1 - nSplitQtyHoriz);
|
||||
if (m_SplitHorizList[m_SplitHorizList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
dNewDimension = 1;
|
||||
m_SplitHorizList[m_SplitHorizList.Count - 1].SetDimension(dNewDimension);
|
||||
}
|
||||
else
|
||||
dNewDimension = dLastDimension / (value + 1 - nSplitQtyHoriz);
|
||||
// aggiungo area Split di default
|
||||
for (var SplitIndex = m_SplitHorizList.Count; SplitIndex <= value; SplitIndex++)
|
||||
m_SplitHorizList.Add(new SplitDimension(dNewDimension, m_SplitHorizList[m_SplitHorizList.Count - 1].MeasureType, true, this, false));
|
||||
}
|
||||
dLastDimension += m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension;
|
||||
m_SplitHorizList[m_SplitHorizList.Count - 1].SetDimension(dLastDimension);
|
||||
}
|
||||
// Controllo quanti split verticali ci sono
|
||||
int nVert = m_SplitVertList.Count > 0 ? m_SplitVertList.Count : 1;
|
||||
// Se aggiungo split devo aggiungere vetro nell'area splitted aggiunta
|
||||
for (var SplitIndex = AreaList.Count; SplitIndex <= (m_SplitHorizList.Count * nVert) - 1; SplitIndex++)
|
||||
{
|
||||
AreaList.Add(Splitted.CreateSplitted(this));
|
||||
Fill newFill = Fill.CreateFill(AreaList[SplitIndex], FillTypes.GLASS);
|
||||
newFill.SetAreaType(AreaTypes.FILL);
|
||||
AreaList[AreaList.Count - 1].AreaList.Add(newFill);
|
||||
}
|
||||
// Se ho più di uno split, elimino l'ultimo
|
||||
if (AreaList.Count > 2)
|
||||
{
|
||||
int nAreaList = AreaList.Count - 1;
|
||||
for (var SplitIndex = (m_SplitHorizList.Count * nVert); SplitIndex <= nAreaList; SplitIndex++)
|
||||
// Ricalcolo dimensioni rimuovendo split
|
||||
else
|
||||
{
|
||||
AreaList.Remove(AreaList[AreaList.Count - 1]);
|
||||
double dLastDimension = 0;
|
||||
for (var SplitIndex = m_SplitHorizList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1)
|
||||
{
|
||||
dLastDimension += m_SplitHorizList[SplitIndex].dDimension;
|
||||
m_SplitHorizList.RemoveAt(SplitIndex);
|
||||
}
|
||||
dLastDimension += m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension;
|
||||
m_SplitHorizList[m_SplitHorizList.Count - 1].SetDimension(dLastDimension);
|
||||
}
|
||||
// Controllo quanti split verticali ci sono
|
||||
int nVert = m_SplitVertList.Count > 0 ? m_SplitVertList.Count : 1;
|
||||
// Se aggiungo split devo aggiungere vetro nell'area splitted aggiunta
|
||||
for (var SplitIndex = AreaList.Count; SplitIndex <= (m_SplitHorizList.Count * nVert) - 1; SplitIndex++)
|
||||
{
|
||||
AreaList.Add(Splitted.CreateSplitted(this));
|
||||
Fill newFill = Fill.CreateFill(AreaList[SplitIndex], FillTypes.GLASS);
|
||||
newFill.SetAreaType(AreaTypes.FILL);
|
||||
AreaList[AreaList.Count - 1].AreaList.Add(newFill);
|
||||
}
|
||||
// Se ho più di uno split, elimino l'ultimo
|
||||
if (AreaList.Count > 2)
|
||||
{
|
||||
int nAreaList = AreaList.Count - 1;
|
||||
for (var SplitIndex = (m_SplitHorizList.Count * nVert); SplitIndex <= nAreaList; SplitIndex++)
|
||||
{
|
||||
AreaList.Remove(AreaList[AreaList.Count - 1]);
|
||||
}
|
||||
}
|
||||
// Se elimino l'unico split presente
|
||||
else
|
||||
{
|
||||
Splitted s = (Splitted)AreaList[0];
|
||||
s.SetParentArea(ParentArea);
|
||||
ParentArea.AreaList.Add(s);
|
||||
ParentArea.AreaList.Remove(this);
|
||||
}
|
||||
}
|
||||
// Se elimino l'unico split presente
|
||||
else
|
||||
{
|
||||
Splitted s = (Splitted)AreaList[0];
|
||||
s.SetParentArea(ParentArea);
|
||||
ParentArea.AreaList.Add(s);
|
||||
ParentArea.AreaList.Remove(this);
|
||||
}
|
||||
}
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,86 +139,116 @@ namespace WebWindowTest.Models
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == 0)
|
||||
if (value >= 0 && value < 6)
|
||||
{
|
||||
for (var SplitIndex = m_SplitVertList.Count - 1; SplitIndex >= value; SplitIndex += -1)
|
||||
m_SplitVertList.RemoveAt(SplitIndex);
|
||||
if (nSplitQtyHoriz == 0)
|
||||
if (value == 0)
|
||||
{
|
||||
ParentArea.AreaList.Remove(this);
|
||||
Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS);
|
||||
newFill.SetAreaType(AreaTypes.FILL);
|
||||
ParentArea.AreaList.Add(newFill);
|
||||
}
|
||||
else
|
||||
SetSplitShape(SplitShapes.HORIZONTAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ricalcolo dimensioni aggiungendo split
|
||||
if (value > m_SplitVertList.Count - 1)
|
||||
{
|
||||
// recupero larghezza ultimo
|
||||
double dLastDimension = 100;
|
||||
double dNewDimension = 100;
|
||||
if (m_SplitVertList.Count > 0)
|
||||
for (var SplitIndex = m_SplitVertList.Count - 1; SplitIndex >= value; SplitIndex += -1)
|
||||
m_SplitVertList.RemoveAt(SplitIndex);
|
||||
if (nSplitQtyHoriz == 0)
|
||||
{
|
||||
dLastDimension = m_SplitVertList[m_SplitVertList.Count - 1].dDimension;
|
||||
dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert);
|
||||
m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dNewDimension);
|
||||
ParentArea.AreaList.Remove(this);
|
||||
Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS);
|
||||
newFill.SetAreaType(AreaTypes.FILL);
|
||||
ParentArea.AreaList.Add(newFill);
|
||||
}
|
||||
else
|
||||
dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert);
|
||||
// aggiungo area Split di default
|
||||
for (var SplitIndex = m_SplitVertList.Count; SplitIndex <= value; SplitIndex++)
|
||||
m_SplitVertList.Add(new SplitDimension(dNewDimension, true, this, true));
|
||||
SetSplitShape(SplitShapes.HORIZONTAL);
|
||||
}
|
||||
else if (value == 0)
|
||||
{
|
||||
m_SplitVertList.RemoveAt(1);
|
||||
m_SplitVertList.RemoveAt(0);
|
||||
}
|
||||
// Ricalcolo dimensioni rimuovendo split
|
||||
else
|
||||
{
|
||||
double dLastDimension = 0;
|
||||
for (var SplitIndex = m_SplitVertList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1)
|
||||
double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension);
|
||||
// Ricalcolo dimensioni aggiungendo split
|
||||
if (value > m_SplitVertList.Count - 1)
|
||||
{
|
||||
dLastDimension += m_SplitVertList[SplitIndex].dDimension;
|
||||
m_SplitVertList.RemoveAt(SplitIndex);
|
||||
// recupero larghezza ultimo
|
||||
double dLastDimension = widthTot;
|
||||
double dNewDimension = widthTot;
|
||||
if (m_SplitVertList.Count > 0)
|
||||
{
|
||||
dLastDimension = m_SplitVertList[m_SplitVertList.Count - 1].dDimension;
|
||||
dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert);
|
||||
if (m_SplitVertList[m_SplitVertList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
dNewDimension = 1;
|
||||
m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dNewDimension);
|
||||
}
|
||||
else
|
||||
dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert);
|
||||
// aggiungo area Split di default
|
||||
for (var SplitIndex = m_SplitVertList.Count; SplitIndex <= value; SplitIndex++)
|
||||
m_SplitVertList.Add(new SplitDimension(dNewDimension, m_SplitVertList[m_SplitVertList.Count - 1].MeasureType, true, this, true));
|
||||
}
|
||||
dLastDimension += m_SplitVertList[m_SplitVertList.Count - 1].dDimension;
|
||||
m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dLastDimension);
|
||||
}
|
||||
// Controllo quanti split orizzontali ci sono
|
||||
int nHoriz = m_SplitHorizList.Count > 0 ? m_SplitHorizList.Count : 1;
|
||||
// Se aggiungo split devo aggiungere vetro nell'area splitted aggiunta
|
||||
for (var SplitIndex = AreaList.Count; SplitIndex <= (m_SplitVertList.Count * nHoriz) - 1; SplitIndex++)
|
||||
{
|
||||
AreaList.Add(Splitted.CreateSplitted(this));
|
||||
Fill newFill = Fill.CreateFill(AreaList[SplitIndex], FillTypes.GLASS);
|
||||
newFill.SetAreaType(AreaTypes.FILL);
|
||||
AreaList[AreaList.Count - 1].AreaList.Add(newFill);
|
||||
}
|
||||
// Se ho più di uno split, elimino l'ultimo
|
||||
if (AreaList.Count > 2)
|
||||
{
|
||||
int nAreaList = AreaList.Count - 1;
|
||||
for (var SplitIndex = (m_SplitVertList.Count * nHoriz); SplitIndex <= nAreaList; SplitIndex++)
|
||||
else if (value == 0)
|
||||
{
|
||||
AreaList.Remove(AreaList[AreaList.Count - 1]);
|
||||
m_SplitVertList.RemoveAt(1);
|
||||
m_SplitVertList.RemoveAt(0);
|
||||
}
|
||||
// Ricalcolo dimensioni rimuovendo split
|
||||
else
|
||||
{
|
||||
int countProportional = m_SplitVertList.Count(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL));
|
||||
if(m_SplitVertList.Last().MeasureType.Equals(MeasureTypes.PROPORTIONAL) && countProportional - 1 == 1)
|
||||
{
|
||||
m_SplitVertList.RemoveAt(m_SplitVertList.Count() - 1);
|
||||
m_SplitVertList.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).FirstOrDefault().SetDimension(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
double dLastDimension = 0;
|
||||
for (var SplitIndex = m_SplitVertList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1)
|
||||
{
|
||||
dLastDimension += m_SplitVertList[SplitIndex].dDimension;
|
||||
m_SplitVertList.RemoveAt(SplitIndex);
|
||||
}
|
||||
dLastDimension += m_SplitVertList[m_SplitVertList.Count - 1].dDimension;
|
||||
m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dLastDimension);
|
||||
}
|
||||
}
|
||||
// Controllo quanti split orizzontali ci sono
|
||||
int nHoriz = m_SplitHorizList.Count > 0 ? m_SplitHorizList.Count : 1;
|
||||
// Se aggiungo split devo aggiungere vetro nell'area splitted aggiunta
|
||||
for (var SplitIndex = AreaList.Count; SplitIndex <= (m_SplitVertList.Count * nHoriz) - 1; SplitIndex++)
|
||||
{
|
||||
AreaList.Add(Splitted.CreateSplitted(this));
|
||||
Fill newFill = Fill.CreateFill(AreaList[SplitIndex], FillTypes.GLASS);
|
||||
newFill.SetAreaType(AreaTypes.FILL);
|
||||
AreaList[AreaList.Count - 1].AreaList.Add(newFill);
|
||||
}
|
||||
// Se ho più di uno split, elimino l'ultimo
|
||||
if (AreaList.Count > 2)
|
||||
{
|
||||
int nAreaList = AreaList.Count - 1;
|
||||
for (var SplitIndex = (m_SplitVertList.Count * nHoriz); SplitIndex <= nAreaList; SplitIndex++)
|
||||
{
|
||||
AreaList.Remove(AreaList[AreaList.Count - 1]);
|
||||
}
|
||||
}
|
||||
// Se elimino l'unico split presente
|
||||
else
|
||||
{
|
||||
Splitted s = (Splitted)AreaList[0];
|
||||
s.SetParentArea(ParentArea);
|
||||
ParentArea.AreaList.Add(s);
|
||||
ParentArea.AreaList.Remove(this);
|
||||
}
|
||||
}
|
||||
// Se elimino l'unico split presente
|
||||
else
|
||||
if(SplitHorizList.Count > 0)
|
||||
{
|
||||
Splitted s = (Splitted)AreaList[0];
|
||||
s.SetParentArea(ParentArea);
|
||||
ParentArea.AreaList.Add(s);
|
||||
ParentArea.AreaList.Remove(this);
|
||||
for (int i = 0; i < AreaList.Count; i++)
|
||||
{
|
||||
if(i < SplitHorizList.Count)
|
||||
AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), SplitHorizList.ElementAt(i).dDimension, "Width");
|
||||
}
|
||||
}
|
||||
if (SplitVertList.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < AreaList.Count; i++)
|
||||
{
|
||||
if(i < SplitVertList.Count)
|
||||
AreaList.ElementAt(i).SearchAreaList(AreaList.ElementAt(i), SplitVertList.ElementAt(i).dDimension, "Height");
|
||||
}
|
||||
}
|
||||
}
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,15 +256,13 @@ namespace WebWindowTest.Models
|
||||
{
|
||||
get
|
||||
{
|
||||
//return IdNameStruct.IndFromId((int)m_SelSplitShape, m_SplitShapeList);
|
||||
return (int)m_SelSplitShape;
|
||||
}
|
||||
set
|
||||
{
|
||||
//m_SelSplitShape = (SplitShapes)IdNameStruct.IdFromInd(value, m_SplitShapeList);
|
||||
SplitShapes OldSelShapeSplit = m_SelSplitShape;
|
||||
m_SelSplitShape = (SplitShapes)value;
|
||||
// Cancello elementi nello split e azzero quantità orizzontale e verticale
|
||||
AreaList.Clear();
|
||||
// Azzero quantità orizzontale e verticale
|
||||
SetSplitQtyVert(0);
|
||||
SetSplitQtyHoriz(0);
|
||||
if (m_SelSplitShape == SplitShapes.VERTICAL)
|
||||
@@ -252,17 +284,21 @@ namespace WebWindowTest.Models
|
||||
SetSplitQtyHoriz(1);
|
||||
SetSplitStartVert(true);
|
||||
}
|
||||
// Aggiungo area Splitted e vetro
|
||||
int nVert = m_SplitVertList.Count > 0 ? m_SplitVertList.Count : 1;
|
||||
int nHoriz = m_SplitHorizList.Count > 0 ? m_SplitHorizList.Count : 1;
|
||||
for (var SplitIndex = 0; SplitIndex <= (nVert * nHoriz) - 1; SplitIndex++)
|
||||
if(OldSelShapeSplit == SplitShapes.GRID || m_SelSplitShape == SplitShapes.GRID)
|
||||
{
|
||||
AreaList.Add(Splitted.CreateSplitted(this));
|
||||
Fill newFill = Fill.CreateFill(AreaList[SplitIndex], FillTypes.GLASS);
|
||||
newFill.SetAreaType(AreaTypes.FILL);
|
||||
AreaList[SplitIndex].AreaList.Add(newFill);
|
||||
// Cancello vecchio contenuto dello split
|
||||
AreaList.Clear();
|
||||
// Aggiungo area Splitted e vetro
|
||||
int nVert = m_SplitVertList.Count > 0 ? m_SplitVertList.Count : 1;
|
||||
int nHoriz = m_SplitHorizList.Count > 0 ? m_SplitHorizList.Count : 1;
|
||||
for (var SplitIndex = 0; SplitIndex <= (nVert * nHoriz) - 1; SplitIndex++)
|
||||
{
|
||||
AreaList.Add(Splitted.CreateSplitted(this));
|
||||
Fill newFill = Fill.CreateFill(AreaList[SplitIndex], FillTypes.GLASS);
|
||||
newFill.SetAreaType(AreaTypes.FILL);
|
||||
AreaList[SplitIndex].AreaList.Add(newFill);
|
||||
}
|
||||
}
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,12 +356,16 @@ namespace WebWindowTest.Models
|
||||
AddCounterGroup();
|
||||
newSplit.SetGroupId(nCounterGroup);
|
||||
newSplit.SetSplitStartVert(bSplitStartVert);
|
||||
newSplit.SetSplitQtyVert(nSplitQtyVert);
|
||||
for (int i = 0; i < SplitVertList.Count; i++)
|
||||
newSplit.SplitVertList.ElementAt(i).SetDimension(SplitVertList.ElementAt(i).dDimension);
|
||||
newSplit.SetSplitQtyHoriz(nSplitQtyHoriz);
|
||||
newSplit.SplitVertList.Add(SplitVertList[i].Copy());
|
||||
for (int i = 0; i < SplitHorizList.Count; i++)
|
||||
newSplit.SplitHorizList.ElementAt(i).SetDimension(SplitHorizList.ElementAt(i).dDimension);
|
||||
newSplit.SplitHorizList.Add(SplitHorizList[i].Copy());
|
||||
//newSplit.SetSplitQtyVert(nSplitQtyVert);
|
||||
//for (int i = 0; i < SplitVertList.Count; i++)
|
||||
// newSplit.SplitVertList.ElementAt(i).SetDimension(SplitVertList.ElementAt(i).dDimension);
|
||||
//newSplit.SetSplitQtyHoriz(nSplitQtyHoriz);
|
||||
//for (int i = 0; i < SplitHorizList.Count; i++)
|
||||
// newSplit.SplitHorizList.ElementAt(i).SetDimension(SplitHorizList.ElementAt(i).dDimension);
|
||||
newSplit.SetSplitShape(SelSplitShape);
|
||||
newSplit.SetAreaType(AreaType);
|
||||
foreach (var item in AreaList)
|
||||
@@ -342,7 +382,7 @@ namespace WebWindowTest.Models
|
||||
Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS);
|
||||
newFill.SetAreaType(AreaTypes.FILL);
|
||||
ParentArea.AreaList.Add(newFill);
|
||||
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
@@ -405,7 +445,7 @@ namespace WebWindowTest.Models
|
||||
dNewDimension = dLastDimension / (QtyHoriz + 1 - nSplitQtyHoriz);
|
||||
// aggiungo area Split di default
|
||||
for (var SplitIndex = m_SplitHorizList.Count; SplitIndex <= QtyHoriz; SplitIndex++)
|
||||
m_SplitHorizList.Add(new SplitDimension(dNewDimension, true, this, false));
|
||||
m_SplitHorizList.Add(new SplitDimension(dNewDimension, MeasureTypes.PERCENTAGE, true, this, false));
|
||||
}
|
||||
else if (QtyHoriz < m_SplitHorizList.Count)
|
||||
{
|
||||
@@ -431,7 +471,7 @@ namespace WebWindowTest.Models
|
||||
dNewDimension = dLastDimension / (QtyVert + 1 - nSplitQtyVert);
|
||||
// aggiungo area Split di default
|
||||
for (var SplitIndex = m_SplitVertList.Count; SplitIndex <= QtyVert; SplitIndex++)
|
||||
m_SplitVertList.Add(new SplitDimension(dNewDimension, true, this, true));
|
||||
m_SplitVertList.Add(new SplitDimension(dNewDimension, MeasureTypes.PERCENTAGE, true, this, true));
|
||||
}
|
||||
else if (QtyVert < m_SplitVertList.Count)
|
||||
{
|
||||
@@ -450,6 +490,31 @@ namespace WebWindowTest.Models
|
||||
m_bSplitStartVert = SplitStartVert;
|
||||
}
|
||||
|
||||
internal double HeightFrame()
|
||||
{
|
||||
switch (ParentWindow.AreaList.First().SelShapeIndex)
|
||||
{
|
||||
case (int)Shapes.RECTANGLE:
|
||||
case (int)Shapes.TRIANGLE:
|
||||
case (int)Shapes.ARC_FULL:
|
||||
{
|
||||
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Height").First().dDimension;
|
||||
}
|
||||
case (int)Shapes.RIGHTCHAMFER:
|
||||
{
|
||||
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Left Height").First().dDimension;
|
||||
}
|
||||
case (int)Shapes.LEFTCHAMFER:
|
||||
{
|
||||
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Right Height").First().dDimension;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Full Height").First().dDimension;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Private Fields
|
||||
@@ -472,6 +537,8 @@ namespace WebWindowTest.Models
|
||||
|
||||
private List<SplitDimension> m_SplitVertList = new List<SplitDimension>();
|
||||
|
||||
//private double m_Width = 0;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,19 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WebWindowTest.Json;
|
||||
using static WebWindowTest.Json.WindowConst;
|
||||
|
||||
namespace WebWindowTest.Models
|
||||
{
|
||||
public class SplitDimension
|
||||
public class SplitDimension:AreaDimension
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public SplitDimension(double dDimension, bool bIsRelative, Split Parent, bool IsVertList)
|
||||
public SplitDimension(double dDimension, MeasureTypes MeasureType, bool bIsRelative, Split Parent, bool IsVertList):base(dDimension, MeasureType)
|
||||
{
|
||||
m_dDimension = dDimension;
|
||||
m_bIsRelative = bIsRelative;
|
||||
@@ -39,7 +41,7 @@ namespace WebWindowTest.Models
|
||||
}
|
||||
}
|
||||
|
||||
public double dDimension
|
||||
public override double dDimension
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -47,79 +49,182 @@ namespace WebWindowTest.Models
|
||||
}
|
||||
set
|
||||
{
|
||||
// Controllo che il valore inserito sia compreso tra 0 e 100
|
||||
if (value > 0 && value < 100)
|
||||
double dimensionTot = 0;
|
||||
List<SplitDimension> dimensions = null;
|
||||
Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault();
|
||||
if (bIsVertListDim)
|
||||
{
|
||||
// se sono in percentuale
|
||||
if (m_bIsRelative)
|
||||
{
|
||||
List<SplitDimension> RelativeDimList = new List<SplitDimension>();
|
||||
if (bIsVertListDim)
|
||||
RelativeDimList = m_Parent.SplitVertList.Where(x => x.bIsRelative).ToList();
|
||||
else
|
||||
RelativeDimList = m_Parent.SplitHorizList.Where(x => x.bIsRelative).ToList();
|
||||
// verifico se ci sono assoluti
|
||||
//List<SplitDimension> RelativeDimList = m_Parent.SplitPositionList.Where(x => x.bIsRelative).ToList();
|
||||
if (RelativeDimList.Count > 0)
|
||||
dimensions = m_Parent.SplitVertList;
|
||||
dimensionTot = CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension;
|
||||
}
|
||||
else
|
||||
{
|
||||
dimensions = m_Parent.SplitHorizList;
|
||||
//dimensionTot = (CalculateHeightSplitGroup(m_Parent, HeightTot(), new AreaFound(-1, false))).m_Dimension;
|
||||
dimensionTot = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension;
|
||||
}
|
||||
double valMinAbsolute = 100;
|
||||
double valMaxAbsolute = dimensionTot - valMinAbsolute * (dimensions.Count - 1);
|
||||
bool valueAccept = false;
|
||||
switch (MeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
if (m_Parent.bIsPercentage)
|
||||
valueAccept = (value < valMaxAbsolute && value > valMinAbsolute) ? true : false;
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
valMaxAbsolute = 20;
|
||||
valueAccept = (value >= 1) ? true : false;
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
valMaxAbsolute = valMaxAbsolute / dimensionTot * 100;
|
||||
valMinAbsolute = valMinAbsolute / dimensionTot * 100;
|
||||
valueAccept = (value < valMaxAbsolute && value > valMinAbsolute) ? true : false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (valueAccept)
|
||||
{
|
||||
List<double> absoluteValList = new List<double>();
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in dimensions)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
foreach (var item in dimensions)
|
||||
{
|
||||
absoluteValList.Add(item.CalculateAbsoluteValue(adList, dimensionTot));
|
||||
}
|
||||
int nIndex = dimensions.IndexOf(this);
|
||||
int proportionalCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count;
|
||||
int percentageCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList().Count;
|
||||
// Le dimensioni sono solo in proporzionale
|
||||
if (proportionalCount == absoluteValList.Count)
|
||||
{
|
||||
m_dDimension = value;
|
||||
}
|
||||
// Le dimensioni sono solo in percentuale
|
||||
else if (percentageCount == dimensions.Count)
|
||||
{
|
||||
if (value < dDimension)
|
||||
{
|
||||
// L'anta modificata non è l'ultima
|
||||
if (nIndex < dimensions.Count - 1)
|
||||
dimensions[nIndex + 1].SetDimension(dimensions[nIndex + 1].dDimension + (m_dDimension - value));
|
||||
else if (dimensions.Count > 1)
|
||||
dimensions[nIndex - 1].SetDimension(dimensions[nIndex - 1].dDimension + (m_dDimension - value));
|
||||
else
|
||||
{
|
||||
int nIndex = RelativeDimList.IndexOf(this);
|
||||
if (value < m_dDimension)
|
||||
m_dDimension = 100;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
double dRes = value;
|
||||
// se non ultima anta
|
||||
if (nIndex < dimensions.Count - 1)
|
||||
{
|
||||
for (var nInd = 0; nInd <= nIndex - 1; nInd++)
|
||||
dRes += dimensions[nInd].dDimension;
|
||||
dRes = (100 - dRes) / (dimensions.Count - nIndex - 1);
|
||||
for (var Ind = nIndex + 1; Ind <= dimensions.Count - 1; Ind++)
|
||||
dimensions[Ind].SetDimension(dRes);
|
||||
}
|
||||
// se ultima anta
|
||||
else if (dimensions.Count > 1)
|
||||
{
|
||||
if (dimensions.Count > 2)
|
||||
{
|
||||
if (nIndex < RelativeDimList.Count - 1)
|
||||
RelativeDimList[nIndex + 1].SetDimension(RelativeDimList[nIndex + 1].dDimension + (m_dDimension - value));
|
||||
else if (RelativeDimList.Count > 1)
|
||||
RelativeDimList[nIndex - 1].SetDimension(RelativeDimList[nIndex - 1].dDimension + (m_dDimension - value));
|
||||
else
|
||||
{
|
||||
m_dDimension = 100;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
double dRes = value;
|
||||
if (nIndex < RelativeDimList.Count - 1)
|
||||
{
|
||||
for (var nInd = 0; nInd <= nIndex - 1; nInd++)
|
||||
dRes += RelativeDimList[nInd].dDimension;
|
||||
dRes = (100 - dRes) / (RelativeDimList.Count - nIndex - 1);
|
||||
if (dRes != 0)
|
||||
{
|
||||
for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++)
|
||||
RelativeDimList[Ind].SetDimension(dRes);
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
else if (RelativeDimList.Count > 1)
|
||||
{
|
||||
if (RelativeDimList.Count > 2)
|
||||
{
|
||||
for (var Ind = 0; Ind <= nIndex - 2; Ind++)
|
||||
dRes += RelativeDimList[Ind].dDimension;
|
||||
}
|
||||
dRes = (100 - dRes);
|
||||
if (dRes != 0)
|
||||
RelativeDimList[nIndex - 1].SetDimension(dRes);
|
||||
else
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dDimension = 100;
|
||||
return;
|
||||
}
|
||||
for (var Ind = 0; Ind <= nIndex - 2; Ind++)
|
||||
dRes += dimensions[Ind].dDimension;
|
||||
}
|
||||
dRes = (100 - dRes);
|
||||
dimensions[nIndex - 1].SetDimension(dRes);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dDimension = 100;
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_dDimension = value;
|
||||
}
|
||||
// Le dimensioni sono miste o solo in assoluto
|
||||
else
|
||||
{
|
||||
double valueInAbsolute = 0;
|
||||
switch (MeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
valueInAbsolute = value;
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
var pesi = value + dimensions
|
||||
.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL) && !x.Equals(this))
|
||||
.Sum(x => x.m_dDimension);
|
||||
valueInAbsolute = dimensionTot / pesi * value;
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
valueInAbsolute = (value / 100) * dimensionTot;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (value < dDimension)
|
||||
{
|
||||
// L'anta modificata non è l'ultima
|
||||
if (nIndex < absoluteValList.Count - 1)
|
||||
{
|
||||
absoluteValList[nIndex + 1] = absoluteValList[nIndex + 1] + (absoluteValList[nIndex] - valueInAbsolute);
|
||||
absoluteValList[nIndex] = valueInAbsolute;
|
||||
}
|
||||
// L'anta modificata è l'ultima
|
||||
else if (dimensions.Count > 1)
|
||||
{
|
||||
absoluteValList[nIndex - 1] = absoluteValList[nIndex - 1] + (absoluteValList[nIndex] - valueInAbsolute);
|
||||
absoluteValList[nIndex] = valueInAbsolute;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// L'anta modificata non è l'ultima
|
||||
if (nIndex < absoluteValList.Count - 1)
|
||||
{
|
||||
absoluteValList[nIndex + 1] = absoluteValList[nIndex + 1] - (valueInAbsolute - absoluteValList[nIndex]);
|
||||
absoluteValList[nIndex] = valueInAbsolute;
|
||||
}
|
||||
// L'anta modificata è l'ultima
|
||||
else if (dimensions.Count > 1)
|
||||
{
|
||||
absoluteValList[nIndex - 1] = absoluteValList[nIndex - 1] - (valueInAbsolute - absoluteValList[nIndex]);
|
||||
absoluteValList[nIndex] = valueInAbsolute;
|
||||
}
|
||||
}
|
||||
if (MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
m_dDimension = value;
|
||||
for (int i = 0; i < absoluteValList.Count; i++)
|
||||
{
|
||||
var item = dimensions.ElementAt(i);
|
||||
item.SetDimension(ad.ConvertIn(adList, absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, dimensionTot));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m_Parent.AreaList.Count; i++)
|
||||
{
|
||||
if (m_Parent.SplitHorizList.Count > 0 && i < m_Parent.SplitHorizList.Count)
|
||||
m_Parent.AreaList.ElementAt(i).SearchAreaList(m_Parent.AreaList.ElementAt(i), m_Parent.SplitHorizList.ElementAt(i).dDimension, "Height");
|
||||
if (m_Parent.SplitVertList.Count > 0 && i < m_Parent.SplitVertList.Count)
|
||||
m_Parent.AreaList.ElementAt(i).SearchAreaList(m_Parent.AreaList.ElementAt(i), m_Parent.SplitVertList.ElementAt(i).dDimension, "Width");
|
||||
}
|
||||
m_dDimension = value;
|
||||
m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,13 +241,128 @@ namespace WebWindowTest.Models
|
||||
}
|
||||
}
|
||||
|
||||
//public MeasureTypes MeasureType
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_SelMeasureType;
|
||||
// }
|
||||
//}
|
||||
|
||||
//public List<IdNameStruct> MeasureTypeList
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_MeasureTypeList;
|
||||
// }
|
||||
//}
|
||||
|
||||
//public MeasureTypes SelMeasureType
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return m_SelMeasureType;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_SelMeasureType = value;
|
||||
// }
|
||||
//}
|
||||
|
||||
public override int SelMeasureTypeIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)m_SelMeasureType;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (m_SelMeasureType != (MeasureTypes)value)
|
||||
{
|
||||
MeasureTypes newType = (MeasureTypes)value;
|
||||
List<SplitDimension> splitList = null;
|
||||
Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault();
|
||||
double tot = 0;
|
||||
if (bIsVertListDim)
|
||||
{
|
||||
splitList = m_Parent.SplitVertList;
|
||||
tot = CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension;
|
||||
}
|
||||
else
|
||||
{
|
||||
splitList = m_Parent.SplitHorizList;
|
||||
tot = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension;
|
||||
}
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in splitList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, tot, splitList.IndexOf(this));
|
||||
m_SelMeasureType = (MeasureTypes)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
///// <summary>
|
||||
///// Metodo per convertire la dimensione dal vecchio tipo al nuovo tipo
|
||||
///// </summary>
|
||||
///// <param name="oldType"> Vecchio tipo </param>
|
||||
///// <param name="newType"> Nuovo tipo </param>
|
||||
///// <returns></returns>
|
||||
//public double ConvertDimension(MeasureTypes oldType, MeasureTypes newType, double widthTot, List<SplitDimension> splitList)
|
||||
//{
|
||||
// switch (oldType)
|
||||
// {
|
||||
// case MeasureTypes.ABSOLUTE:
|
||||
// {
|
||||
// if (newType.Equals(MeasureTypes.PERCENTAGE))
|
||||
// {
|
||||
// //return Double.Round((m_dDimension / m_Parent.Width) * 100, 1);
|
||||
// return (m_dDimension / widthTot) * 100;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return CalculatePropVal(widthTot, splitList);
|
||||
// }
|
||||
// }
|
||||
// case MeasureTypes.PROPORTIONAL:
|
||||
// {
|
||||
// if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
// {
|
||||
// //return Double.Round(ConvertFromPropVal(newType), 2);
|
||||
// return ConvertFromPropVal(newType, widthTot, splitList);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //return Double.Round(ConvertFromPropVal(newType), 1);
|
||||
// return ConvertFromPropVal(newType, widthTot, splitList);
|
||||
// }
|
||||
// }
|
||||
// case MeasureTypes.PERCENTAGE:
|
||||
// {
|
||||
// if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
// {
|
||||
// //return Double.Round((m_dDimension * m_Parent.Width) / 100, 2);
|
||||
// return (m_dDimension * widthTot) / 100;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return CalculatePropVal(widthTot, splitList);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
public SplitDimension Copy()
|
||||
{
|
||||
SplitDimension newSplitDim = new SplitDimension(dDimension, bIsRelative, m_Parent, bIsVertListDim);
|
||||
SplitDimension newSplitDim = new SplitDimension(dDimension, MeasureType, bIsRelative, m_Parent, bIsVertListDim);
|
||||
return newSplitDim;
|
||||
}
|
||||
|
||||
@@ -150,16 +370,356 @@ namespace WebWindowTest.Models
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per calcolare larghezza intero split group
|
||||
/// </summary>
|
||||
/// <param name="area"> area di partenza </param>
|
||||
/// <param name="width"> larghezza di partenza </param>
|
||||
/// <param name="res"> area di ritorno </param>
|
||||
/// <returns></returns>
|
||||
internal AreaFound CalculateWidthSplitGroup(Area area, double width, AreaFound res)
|
||||
{
|
||||
for (int i = 0; i < area.AreaList.Count; i++)
|
||||
{
|
||||
if (area.Equals(m_Parent))
|
||||
{
|
||||
res.m_Dimension = width;
|
||||
res.m_Found = true;
|
||||
return res;
|
||||
}
|
||||
Area item = area.AreaList[i];
|
||||
if (area is Split)
|
||||
{
|
||||
Split split = (Split)area;
|
||||
if(split.SplitVertList.Count > 0)
|
||||
{
|
||||
int index = i;
|
||||
if (split.SelSplitShape is SplitShapes.GRID)
|
||||
index = i % split.SplitHorizList.Count;
|
||||
switch (split.SplitVertList.ElementAt(index).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension, res);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(index).dDimension, split.SplitVertList.ElementAt(index).SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in split.SplitVertList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width), res);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
res = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(index).dDimension * width / 100, res);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = CalculateWidthSplitGroup(item, width, res);
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
}
|
||||
else if (area is Sash)
|
||||
{
|
||||
Sash sash = (Sash)area;
|
||||
switch (sash.SashList.ElementAt(i).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
res = CalculateWidthSplitGroup(item, sash.SashList.ElementAt(i).dDimension, res);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in sash.SashList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width), res);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
res = CalculateWidthSplitGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100, res);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = CalculateWidthSplitGroup(item, width, res);
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per calcolare altezza intero split group
|
||||
/// </summary>
|
||||
/// <param name="area"> area di partenza </param>
|
||||
/// <param name="height"> altezza di partenza </param>
|
||||
/// <param name="res"> area di ritorno </param>
|
||||
/// <returns></returns>
|
||||
internal AreaFound CalculateHeightSplitGroup(Area area, double height, AreaFound res)
|
||||
{
|
||||
for (int i = 0; i < area.AreaList.Count; i++)
|
||||
{
|
||||
if (area.Equals(m_Parent))
|
||||
{
|
||||
res.m_Dimension = height;
|
||||
res.m_Found = true;
|
||||
return res;
|
||||
}
|
||||
Area item = area.AreaList[i];
|
||||
if (area is Split)
|
||||
{
|
||||
Split split = (Split)area;
|
||||
if (split.SplitHorizList.Count > 0)
|
||||
{
|
||||
int index = i;
|
||||
if (split.SelSplitShape is SplitShapes.GRID)
|
||||
index = i % split.SplitHorizList.Count;
|
||||
switch (split.SplitHorizList.ElementAt(index).SelMeasureType)
|
||||
{
|
||||
case MeasureTypes.ABSOLUTE:
|
||||
{
|
||||
double heightItemGroup = split.SplitHorizList.ElementAt(index).dDimension;
|
||||
res = CalculateHeightSplitGroup(item, heightItemGroup, res);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PROPORTIONAL:
|
||||
{
|
||||
AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(index).dDimension, split.SplitHorizList.ElementAt(index).SelMeasureType);
|
||||
List<AreaDimension> adList = new List<AreaDimension>();
|
||||
foreach (var it in split.SplitHorizList)
|
||||
{
|
||||
adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType));
|
||||
}
|
||||
double heightItemGroup = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, height);
|
||||
res = CalculateHeightSplitGroup(item, heightItemGroup, res);
|
||||
break;
|
||||
}
|
||||
case MeasureTypes.PERCENTAGE:
|
||||
{
|
||||
double heightItemGroup = split.SplitHorizList.ElementAt(index).dDimension * height / 100;
|
||||
res = CalculateHeightSplitGroup(item, heightItemGroup, res);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = CalculateHeightSplitGroup(item, height, res);
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res = CalculateHeightSplitGroup(item, height, res);
|
||||
if (res.m_Dimension != -1 && res.m_Found)
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Calcolo MCD
|
||||
///// </summary>
|
||||
///// <param name="a"></param>
|
||||
///// <param name="b"></param>
|
||||
///// <returns></returns>
|
||||
//internal static double CalculateMCD(double a, double b)
|
||||
//{
|
||||
// while (b >= 0.01)
|
||||
// {
|
||||
// double temp = b;
|
||||
// b = a % b;
|
||||
// a = temp;
|
||||
// }
|
||||
// //return Double.Round(a,2);
|
||||
// return a;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//internal double CalculatePropVal(double widthTot, List<SplitDimension> splitList)
|
||||
//{
|
||||
// if (splitList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0)
|
||||
// {
|
||||
// return 1;
|
||||
// }
|
||||
// List<double> absoluteValue = new List<double>();
|
||||
// foreach (var item in splitList)
|
||||
// {
|
||||
// absoluteValue.Add(item.CalculateAbsoluteValue(widthTot, splitList));
|
||||
// }
|
||||
// for (int i = 0; i < splitList.Count; i++)
|
||||
// {
|
||||
// if (!splitList.ElementAt(i).Equals(this) &&
|
||||
// splitList.ElementAt(i).MeasureType.Equals(MeasureTypes.PROPORTIONAL))
|
||||
// {
|
||||
// int nIndex = splitList.IndexOf(this);
|
||||
// if (absoluteValue.ElementAt(nIndex) <= absoluteValue.ElementAt(i))
|
||||
// {
|
||||
// var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
|
||||
// splitList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
|
||||
// m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
|
||||
// splitList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
|
||||
// m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// return m_dDimension;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Metodo per trasformare una dimensione in valore assoluto rispetto alla larghezza totale
|
||||
///// </summary>
|
||||
///// <param name="widthTot"> Larghezza totale </param>
|
||||
///// <returns></returns>
|
||||
//internal double CalculateAbsoluteValue(double widthTot, List<SplitDimension> splitList)
|
||||
//{
|
||||
// switch (MeasureType)
|
||||
// {
|
||||
// case MeasureTypes.ABSOLUTE:
|
||||
// {
|
||||
// //return Double.Round(dDimension, 2);
|
||||
// return dDimension;
|
||||
// }
|
||||
// case MeasureTypes.PROPORTIONAL:
|
||||
// {
|
||||
// //return Double.Round(Proportional2AbsolutVal(), 2);
|
||||
// return Proportional2AbsoluteVal(widthTot, splitList);
|
||||
// }
|
||||
// case MeasureTypes.PERCENTAGE:
|
||||
// {
|
||||
// //return Double.Round((dDimension / 100) * widthTot, 1);
|
||||
// return (dDimension / 100) * widthTot;
|
||||
// }
|
||||
// }
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Metodo per convertire una dimensione da un valore assoluto al suo rispettivo tipo
|
||||
///// </summary>
|
||||
///// <param name="absoluteVal"> Valore assoluto </param>
|
||||
///// <param name="type"> Tipo di misura della dimensione </param>
|
||||
///// <param name="widthTot"> Larghezza totale </param>
|
||||
///// <returns></returns>
|
||||
//internal double ConvertIn(double absoluteVal, MeasureTypes type, double widthTot, List<SplitDimension> splitList)
|
||||
//{
|
||||
// switch (type)
|
||||
// {
|
||||
// case MeasureTypes.ABSOLUTE:
|
||||
// {
|
||||
// return absoluteVal;
|
||||
// }
|
||||
// case MeasureTypes.PROPORTIONAL:
|
||||
// {
|
||||
// return Proportional2AbsoluteVal(widthTot, splitList);
|
||||
// }
|
||||
// case MeasureTypes.PERCENTAGE:
|
||||
// {
|
||||
// return (absoluteVal / widthTot) * 100;
|
||||
// }
|
||||
// }
|
||||
// return -1;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Metodo per convertire da misura proporzionale a misura assoluta o percentuale
|
||||
///// </summary>
|
||||
///// <param name="newType"></param>
|
||||
///// <returns></returns>
|
||||
//internal double ConvertFromPropVal(MeasureTypes newType, double widthTot, List<SplitDimension> splitList)
|
||||
//{
|
||||
// double tot = widthTot;
|
||||
// //Somma misura non proporzionali
|
||||
// double sumNotProp = splitList
|
||||
// .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this))
|
||||
// .Sum(m => m.CalculateAbsoluteValue(tot, splitList));
|
||||
// //Calcolo residuo
|
||||
// double res = tot - sumNotProp;
|
||||
// if (res < 0) res = 0;
|
||||
// //Misure proporzionali
|
||||
// var proportionalList = splitList
|
||||
// .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
// .ToList();
|
||||
|
||||
// double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
// if (sumPesi == 0) sumPesi = 1;
|
||||
// if (newType.Equals(MeasureTypes.ABSOLUTE))
|
||||
// {
|
||||
// return res / sumPesi * dDimension;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return (res / sumPesi * dDimension) / tot * 100;
|
||||
// }
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Metodo per trasformare il valore proporzionale in assoluto
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//internal double Proportional2AbsoluteVal(double widthTot, List<SplitDimension> splitList)
|
||||
//{
|
||||
// double tot = widthTot;
|
||||
// //Somma misura non proporzionali
|
||||
// double sumNotProp = splitList
|
||||
// .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL)
|
||||
// .Sum(m => m.CalculateAbsoluteValue(tot, splitList));
|
||||
// //Calcolo residuo
|
||||
// double res = tot - sumNotProp;
|
||||
// if (res < 0) res = 0;
|
||||
// //Misure proporzionali
|
||||
// var proportionalList = splitList
|
||||
// .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
|
||||
// .ToList();
|
||||
// double sumPesi = proportionalList.Sum(p => p.dDimension);
|
||||
// if (sumPesi == 0) sumPesi = 1;
|
||||
// return res / sumPesi * dDimension;
|
||||
//}
|
||||
|
||||
internal JsonSplitDimension Serialize()
|
||||
{
|
||||
JsonSplitDimension JsonSplitDimension = new JsonSplitDimension(m_bIsRelative, m_dDimension);
|
||||
JsonSplitDimension JsonSplitDimension = new JsonSplitDimension(m_bIsRelative, m_dDimension, MeasureType);
|
||||
return JsonSplitDimension;
|
||||
}
|
||||
|
||||
internal void SetDimension(double dValue)
|
||||
{
|
||||
m_dDimension = dValue;
|
||||
}
|
||||
//internal void SetDimension(double dValue)
|
||||
//{
|
||||
// m_dDimension = dValue;
|
||||
//}
|
||||
|
||||
internal void SetIsRelative(bool value)
|
||||
{
|
||||
@@ -171,6 +731,58 @@ namespace WebWindowTest.Models
|
||||
m_bIsVertListDim = value;
|
||||
}
|
||||
|
||||
internal void SetMeasureType(MeasureTypes value)
|
||||
{
|
||||
m_SelMeasureType = value;
|
||||
}
|
||||
|
||||
internal void SetSelMeasureType(MeasureTypes value)
|
||||
{
|
||||
if (m_SelMeasureType != (MeasureTypes)value)
|
||||
{
|
||||
MeasureTypes newType = (MeasureTypes)value;
|
||||
Frame frame = m_Parent.ParentWindow.AreaList.FirstOrDefault();
|
||||
double dimSplitGroup = 0;
|
||||
if (bIsVertListDim)
|
||||
{
|
||||
dimSplitGroup = (CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false))).m_Dimension;
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
List<AreaDimension> newDimensions = new List<AreaDimension>();
|
||||
foreach (var item in m_Parent.SplitVertList)
|
||||
{
|
||||
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitVertList.IndexOf(this));
|
||||
if (newType is MeasureTypes.PROPORTIONAL)
|
||||
{
|
||||
for (int i = 0; i < m_Parent.SplitVertList.Count; i++)
|
||||
{
|
||||
m_Parent.SplitVertList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
|
||||
}
|
||||
} }
|
||||
else
|
||||
{
|
||||
//tot = (CalculateHeightSplitGroup(m_Parent, HeightTot(), new AreaFound(-1, false))).m_Dimension;
|
||||
dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension;
|
||||
AreaDimension ad = new AreaDimension(dDimension, SelMeasureType);
|
||||
List<AreaDimension> newDimensions = new List<AreaDimension>();
|
||||
foreach (var item in m_Parent.SplitHorizList)
|
||||
{
|
||||
newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType));
|
||||
}
|
||||
m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitHorizList.IndexOf(this));
|
||||
if(newType is MeasureTypes.PROPORTIONAL)
|
||||
{
|
||||
for(int i = 0; i < m_Parent.SplitHorizList.Count; i++)
|
||||
{
|
||||
m_Parent.SplitHorizList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_SelMeasureType = (MeasureTypes)value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Private Fields
|
||||
@@ -179,11 +791,32 @@ namespace WebWindowTest.Models
|
||||
|
||||
private bool m_bIsVertListDim = false;
|
||||
|
||||
private double m_dDimension;
|
||||
//private double m_dDimension;
|
||||
|
||||
//private List<IdNameStruct> m_MeasureTypeList = new List<IdNameStruct>
|
||||
//{
|
||||
// new IdNameStruct((int)MeasureTypes.ABSOLUTE, "Absolute"),
|
||||
// new IdNameStruct((int)MeasureTypes.PROPORTIONAL, "Proportional"),
|
||||
// new IdNameStruct((int)MeasureTypes.PERCENTAGE, "Percentage"),
|
||||
//};
|
||||
|
||||
//private MeasureTypes m_SelMeasureType;
|
||||
|
||||
// reference
|
||||
private Split m_Parent;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
|
||||
public class AreaFound
|
||||
{
|
||||
public AreaFound(double dimension, bool found)
|
||||
{
|
||||
m_Dimension = dimension;
|
||||
m_Found = found;
|
||||
}
|
||||
|
||||
public double m_Dimension { get; set; } = -1;
|
||||
public bool m_Found { get; set; } = false;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ using System.Xml.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using WebWindowTest.Json;
|
||||
using static WebWindowTest.Json.WindowConst;
|
||||
using static WebWindowTest.ParametriOpzioni;
|
||||
using static WebWindowTest.Models.ParametriOpzioni;
|
||||
|
||||
namespace WebWindowTest.Models
|
||||
{
|
||||
@@ -19,9 +19,9 @@ namespace WebWindowTest.Models
|
||||
{
|
||||
#region Public Events
|
||||
|
||||
public event EventHandler<OnPreviewEventArgs> OnPreview = delegate { };
|
||||
public event EventHandler<OnReqShapeEventArgs> OnReqShape = delegate { };
|
||||
public event EventHandler<OnReqHwOptEventArgs> OnReqHwOption = delegate { };
|
||||
//public event EventHandler<OnPreviewEventArgs> OnPreview = delegate { };
|
||||
//public event EventHandler<OnReqShapeEventArgs> OnReqShape = delegate { };
|
||||
//public event EventHandler<OnReqHwOptEventArgs> OnReqHwOption = delegate { };
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
@@ -48,7 +48,6 @@ namespace WebWindowTest.Models
|
||||
set
|
||||
{
|
||||
m_sColorMaterial = value;
|
||||
OnUpdatePreview(sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +60,6 @@ namespace WebWindowTest.Models
|
||||
set
|
||||
{
|
||||
m_sGlass = value;
|
||||
OnUpdatePreview(sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +72,6 @@ namespace WebWindowTest.Models
|
||||
set
|
||||
{
|
||||
m_sMaterial = value;
|
||||
OnUpdatePreview(sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +84,6 @@ namespace WebWindowTest.Models
|
||||
set
|
||||
{
|
||||
m_sProfilePath = value;
|
||||
OnUpdatePreview(sSerialized());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,35 +91,35 @@ namespace WebWindowTest.Models
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
internal void OnUpdatePreview(string sJwd)
|
||||
{
|
||||
OnPreviewEventArgs e = new OnPreviewEventArgs(sJwd);
|
||||
EventHandler<OnPreviewEventArgs> handler = OnPreview;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
//internal void OnUpdatePreview(string sJwd)
|
||||
//{
|
||||
// OnPreviewEventArgs e = new OnPreviewEventArgs(sJwd);
|
||||
// EventHandler<OnPreviewEventArgs> handler = OnPreview;
|
||||
// if (handler != null)
|
||||
// {
|
||||
// handler(this, e);
|
||||
// }
|
||||
//}
|
||||
|
||||
internal void OnReqShapePreview(string sJwd, int groupId)
|
||||
{
|
||||
OnReqShapeEventArgs e = new OnReqShapeEventArgs(sJwd, groupId);
|
||||
EventHandler<OnReqShapeEventArgs> handler = OnReqShape;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
//internal void OnReqShapePreview(string sJwd, int groupId)
|
||||
//{
|
||||
// OnReqShapeEventArgs e = new OnReqShapeEventArgs(sJwd, groupId);
|
||||
// EventHandler<OnReqShapeEventArgs> handler = OnReqShape;
|
||||
// if (handler != null)
|
||||
// {
|
||||
// handler(this, e);
|
||||
// }
|
||||
//}
|
||||
|
||||
internal void OnReqHwOptionPreview(string sJwd, int groupId)
|
||||
{
|
||||
OnReqHwOptEventArgs e = new OnReqHwOptEventArgs(sJwd, groupId);
|
||||
EventHandler<OnReqHwOptEventArgs> handler = OnReqHwOption;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
//internal void OnReqHwOptionPreview(string sJwd, int groupId)
|
||||
//{
|
||||
// OnReqHwOptEventArgs e = new OnReqHwOptEventArgs(sJwd, groupId);
|
||||
// EventHandler<OnReqHwOptEventArgs> handler = OnReqHwOption;
|
||||
// if (handler != null)
|
||||
// {
|
||||
// handler(this, e);
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Serializzazione dell'oggetto windows
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
using Egw.Window.Data;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WebWindowTest.Json;
|
||||
using WebWindowTest.Models;
|
||||
using static WebWindowTest.Json.WindowConst;
|
||||
|
||||
namespace WebWindowTest
|
||||
{
|
||||
public class SerialMan
|
||||
{
|
||||
/// <summary>
|
||||
/// Riceve un JWD in ingresso e effettua una sostituzione dei parametri rieschiesti (SE non nulli)
|
||||
/// </summary>
|
||||
/// <param name="currSer"></param>
|
||||
/// <param name="newFamilyHardware"></param>
|
||||
/// <param name="newHardware"></param>
|
||||
/// <param name="newColorMaterial"></param>
|
||||
/// <returns>Valore serializzato con le modifiche richieste</returns>
|
||||
public static string MassUpdate(string currSer, string? newFamilyHardware, Hardware? newHardware, string? newColorMaterial, string? newMaterial, string? newGlass, string? newProfile)
|
||||
{
|
||||
string outVal = currSer;
|
||||
// serializzazione JWD --> window
|
||||
JsonWindow WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(currSer, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
|
||||
Window currWindow = WindowFromJson.Deserialize();
|
||||
// verifica 1:1 delle richieste
|
||||
if (!string.IsNullOrEmpty(newFamilyHardware))
|
||||
{
|
||||
SearchSash(currWindow.AreaList.First(), newFamilyHardware, null);
|
||||
}
|
||||
if (newHardware != null)
|
||||
{
|
||||
SearchSash(currWindow.AreaList.First(), null, newHardware);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(newColorMaterial))
|
||||
{
|
||||
currWindow.sColorMaterial = newColorMaterial;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(newMaterial))
|
||||
{
|
||||
currWindow.sMaterial = newMaterial;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(newGlass))
|
||||
{
|
||||
currWindow.sGlass = newGlass;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(newProfile))
|
||||
{
|
||||
currWindow.sProfilePath = newProfile;
|
||||
}
|
||||
var CurrJwd = JsonConvert.SerializeObject(currWindow.Serialize(), Formatting.Indented);
|
||||
return CurrJwd;
|
||||
|
||||
|
||||
}
|
||||
|
||||
internal static void SearchSash(Area currentArea, string? newFamilyHw, Hardware? newHardware)
|
||||
{
|
||||
if (currentArea.AreaType.Equals(AreaTypes.SASH))
|
||||
{
|
||||
Sash s = (Sash)currentArea;
|
||||
if (!string.IsNullOrEmpty(newFamilyHw))
|
||||
{
|
||||
s.SelFamilyHardware = newFamilyHw;
|
||||
}
|
||||
if (newHardware != null)
|
||||
{
|
||||
s.SelHardware = newHardware;
|
||||
}
|
||||
}
|
||||
foreach (Area child in currentArea.AreaList)
|
||||
{
|
||||
SearchSash(child, newFamilyHw, newHardware);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebWindowTest
|
||||
{
|
||||
public class Template
|
||||
{
|
||||
private int m_nIndex;
|
||||
public int nIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_nIndex;
|
||||
}
|
||||
}
|
||||
|
||||
public string sDescription { get; set; } = "";
|
||||
|
||||
private string m_JWD;
|
||||
public string JWD
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_JWD;
|
||||
}
|
||||
}
|
||||
|
||||
private string m_SVG;
|
||||
public string SVG
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SVG;
|
||||
}
|
||||
}
|
||||
|
||||
public Template(int nIndex, string sDescription, string SVG, string JWD)
|
||||
{
|
||||
m_nIndex = nIndex;
|
||||
this.sDescription = sDescription;
|
||||
m_SVG = SVG;
|
||||
m_JWD = JWD;
|
||||
}
|
||||
}
|
||||
}
|
||||
+88
-136
@@ -21,103 +21,40 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (listErrLink != null && listErrLink.Count > 0)
|
||||
{
|
||||
<div class="alert alert-danger">
|
||||
<div class="fs-3">Errore configurazione:</div>
|
||||
<div class="col-12">
|
||||
<ul class="list-group">
|
||||
@foreach (var item in listErrLink)
|
||||
{
|
||||
<li class="list-group-item">@item.Value</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="@mainCss()">
|
||||
<div class="col-md-12 col-lg-6 d-flex flex-column">
|
||||
<div class="card text-center table-svg shadow rounded">
|
||||
<div class="card-header" style="background-color: #d5f1f2;">
|
||||
<div class="d-flex justify-content-between align-middle">
|
||||
<div class="col-8 d-grid px-2 d-md-flex justify-content-md-start">
|
||||
<div class="row justify-content-between align-middle flex-wrap">
|
||||
<div class="col-md-12 col-lg-6 d-grid px-2 d-md-flex justify-content-md-start flex-wrap">
|
||||
<ul class="nav nav-tabs card-header-tabs">
|
||||
@if (string.IsNullOrEmpty(LiveData.CurrJwd))
|
||||
{
|
||||
<li class="nav-item m-1">
|
||||
@if (currStep == CompileStep.Template)
|
||||
{
|
||||
<button data-target="#Template" class="nav-link active fw-bold" @onclick="() => AdvStep(CompileStep.Template)">Template</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button data-target="#Template" class="nav-link text-secondary" @onclick="() => AdvStep(CompileStep.Template)">Template</button>
|
||||
}
|
||||
</li>
|
||||
}
|
||||
@if (FrameWindow != null)
|
||||
{
|
||||
<li class="nav-item m-1">
|
||||
<button data-target="#Tree" class="@tabNavCss(CompileStep.Tree)" @onclick="() => NextStep(CompileStep.Tree)">Tree</button>
|
||||
</li>
|
||||
<li class="nav-item m-1">
|
||||
<button data-target="#General" class="@tabNavCss(CompileStep.General)" @onclick="() => NextStep(CompileStep.General)">General</button>
|
||||
</li>
|
||||
}
|
||||
<li class="nav-item m-1">
|
||||
<button data-target="#Tree" class="@tabNavCss(CompileStep.Tree)" @onclick="() => NextStep(CompileStep.Tree)">Tree</button>
|
||||
</li>
|
||||
<li class="nav-item m-1">
|
||||
<button data-target="#General" class="@tabNavCss(CompileStep.General)" @onclick="() => NextStep(CompileStep.General)">General</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="@buttonCss()">
|
||||
<div class="col d-flex">
|
||||
@if (currStep != CompileStep.Template)
|
||||
{
|
||||
<button class="btn btn-lg btn-primary" style="font-size: 1rem;" @onclick="DoReset">Reset</button>
|
||||
}
|
||||
<div class="col-md-12 col-lg-6 d-grid gap-1 d-md-flex justify-content-md-end align-items-center flex-wrap">
|
||||
<div class="col d-flex justify-content-md-end">
|
||||
<button class="btn btn-lg btn-primary" style="font-size: 1rem;" @onclick="DoReset">Reset</button>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="col d-flex justify-content-md-end">
|
||||
<button class="btn btn-lg btn-primary" style="font-size: 1rem;" @onclick="DoSave">Save</button>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="col d-flex justify-content-md-end">
|
||||
<button class="btn btn-lg btn-primary" style="font-size: 1rem;" @onclick="DoClose">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body bg-transparent">
|
||||
@if (string.IsNullOrEmpty(LiveData.CurrJwd))
|
||||
{
|
||||
@if (currStep == CompileStep.Template && ListPayload.TemplateDTO != null)
|
||||
{
|
||||
<table class="table table-hover align-middle shadow-sm">
|
||||
<thead class="fs-5">
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col" class="col-4">Image</th>
|
||||
<th scope="col" class="text-start">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-group-divider fs-5">
|
||||
@foreach (var item in ListPayload.TemplateDTO)
|
||||
{
|
||||
string colorClass = "";
|
||||
@if (SelTemplateDTO != null && item.Index == SelTemplateDTO.Index)
|
||||
colorClass = "table-success";
|
||||
else
|
||||
colorClass = "";
|
||||
<tr style="height: 120px;" class="@colorClass" @onclick="() => DoSelect(item)">
|
||||
<td>@item.Index</td>
|
||||
<td><img class="img-fluid" width="100" src="@item.ImageUrl" /></td>
|
||||
<td class="text-start">@item.Description</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
}
|
||||
@if (currStep == CompileStep.Tree)
|
||||
{
|
||||
<CardTree ItemTableList="m_ItemTableList"
|
||||
maxCol="m_maxCol"
|
||||
<CardTree ItemTableList="m_ItemTableList"
|
||||
maxCol="m_maxCol"
|
||||
EC_NextStep="NextStepArgs">
|
||||
</CardTree>
|
||||
}
|
||||
@@ -127,103 +64,118 @@
|
||||
{
|
||||
m_PreviousWindow = m_CurrWindow;
|
||||
}
|
||||
<CardFrame FrameWindow="m_Frame"
|
||||
SashList="m_SashList"
|
||||
SplitList="m_SplitList"
|
||||
EC_ChangeAllJoints="ChangeAllJoints"
|
||||
EC_AddSash="() => AddSashToFrame(FrameWindow!)"
|
||||
EC_AddSplit="() => AddSplitToFrame(FrameWindow!)"
|
||||
EC_ReqClose="ReturnTree"
|
||||
EC_ReqResetDictShape="ReqResetDict"
|
||||
EC_UpdateShape="UpdateShape"
|
||||
EC_UpdateFrame="UpdateFrame">
|
||||
</CardFrame>
|
||||
<CascadingValue Value="FrameWindow" Name="CurrFrameWindow">
|
||||
<CascadingValue Value="m_SashList" Name="SashList">
|
||||
<CascadingValue Value="m_SplitList" Name="SplitList">
|
||||
<CardFrame EC_ReqResetDict="ReqResetDict"
|
||||
EC_ReqOptionHw="UpdateHwOptionsFrame"
|
||||
EC_UpdateFrame="UpdatePreviewFrame"
|
||||
EC_ReqClose="ReturnTree">
|
||||
</CardFrame>
|
||||
</CascadingValue>
|
||||
</CascadingValue>
|
||||
</CascadingValue>
|
||||
}
|
||||
else if (currStep == CompileStep.Split)
|
||||
{
|
||||
@if (currSplit >= SplitList.Count || currSplit == -1)
|
||||
@if (currSplitIndex >= SplitList.Count || currSplitIndex == -1)
|
||||
{
|
||||
currStep = CompileStep.Tree;
|
||||
}
|
||||
else
|
||||
{
|
||||
<CardSplit SashList="m_SashList"
|
||||
SplitList="m_SplitList"
|
||||
CurrIndex="currSplit"
|
||||
CurrItem="SplitList[currSplit]"
|
||||
EC_SwapTwoAree="SwapTwoAree"
|
||||
EC_RemoveArea="RemoveArea"
|
||||
EC_ReqResetDictShape="ReqResetDict"
|
||||
EC_ChangeStartVert="changeStartVert"
|
||||
<CardSplit CurrSplit="SplitList[currSplitIndex]"
|
||||
SashList="SashList"
|
||||
SplitList="SplitList"
|
||||
FrameWindow="FrameWindow"
|
||||
EC_UpdateFrame="UpdatePreviewFrame"
|
||||
EC_ReqResetDict="ReqResetDict"
|
||||
EC_UpdateSplit="UpdatePreviewSplit"
|
||||
EC_ReqClose="ReturnTree">
|
||||
</CardSplit>
|
||||
}
|
||||
}
|
||||
else if (currStep == CompileStep.Sash)
|
||||
{
|
||||
@if (currSash >= SashList.Count || currSash == -1)
|
||||
@if (currSashIndex >= SashList.Count || currSashIndex == -1)
|
||||
{
|
||||
currStep = CompileStep.Tree;
|
||||
}
|
||||
else
|
||||
{
|
||||
<CardSashGroup CurrIndex="currSash"
|
||||
CurrItem="SashList[currSash]"
|
||||
SashList="m_SashList"
|
||||
EC_ChangeAllJoints="ChangeAllJoints"
|
||||
EC_ChangeHandle="ChangeHandle"
|
||||
EC_CopyContentSash="CopyContentSash"
|
||||
EC_RemoveArea="RemoveArea"
|
||||
EC_UpdateSash="UpdateSash"
|
||||
EC_UpdateSashHardware="UpdateHwOptions"
|
||||
EC_CallFirstHwOpt="CallFirstHwOpt"
|
||||
EC_ReqResetDictShape="ReqResetDict"
|
||||
EC_ReqClose="ReturnTree">
|
||||
</CardSashGroup>
|
||||
<CascadingValue Value="currLoading" Name="IsLoading">
|
||||
<CascadingValue Value="SashList[currSashIndex]" Name="CurrSashGroup">
|
||||
<CascadingValue Value="SashList" Name="SashList">
|
||||
<CardSashGroup FrameWindow="FrameWindow"
|
||||
EC_UpdateFrame="UpdatePreviewFrame"
|
||||
EC_UpdateSashGroup="UpdatePreviewSashGroup"
|
||||
EC_ReqResetDict="ReqResetDict"
|
||||
EC_ReqOptionHw="UpdateHwOptionsSash"
|
||||
EC_ReqFirstOptionHw="ReqFirstOptionHw"
|
||||
EC_ReqClose="ReturnTree">
|
||||
</CardSashGroup>
|
||||
</CascadingValue>
|
||||
</CascadingValue>
|
||||
</CascadingValue>
|
||||
}
|
||||
}
|
||||
else if (currStep == CompileStep.Fill)
|
||||
{
|
||||
@if (currFill >= FillList.Count || currFill == -1)
|
||||
@if (currFillIndex >= FillList.Count || currFillIndex == -1)
|
||||
{
|
||||
currStep = CompileStep.Tree;
|
||||
}
|
||||
else
|
||||
{
|
||||
<CardFill CurrIndex="currFill"
|
||||
CurrItem="FillList[currFill]"
|
||||
FillList="m_FillList"
|
||||
SashList="m_SashList"
|
||||
SplittedList="m_SplittedList"
|
||||
EC_ChangeAllType="ChangeAllFill"
|
||||
EC_ChangeType="ChangeOneFill"
|
||||
EC_AddSash="AddSashIntoSplit"
|
||||
EC_CopySash="CopySash"
|
||||
<CardFill CurrIndex="currFillIndex"
|
||||
CurrFill="FillList[currFillIndex]"
|
||||
EC_UpdateFill="UpdatePreviewFill"
|
||||
EC_ReqClose="ReturnTree">
|
||||
</CardFill>
|
||||
<div class="card shadow-sm rounded mb-2">
|
||||
<div class="card-body py-2">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="col-4 d-flex justify-content-left">
|
||||
<h5 class="text-center text-nowrap">All fill</h5>
|
||||
</div>
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllFill(WebWindowTest.Json.WindowConst.FillTypes.GLASS)">All glass</button>
|
||||
</div>
|
||||
<div class="input-group mb-2 justify-content-center">
|
||||
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllFill(WebWindowTest.Json.WindowConst.FillTypes.WOOD)">All wood</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (SplittedList != null && SplittedList.Count > 0)
|
||||
{
|
||||
Splitted currSplitted = SplittedList.Where(x => x.AreaList.First().Equals(FillList[currFillIndex])).FirstOrDefault() ?? new Splitted(null, null);
|
||||
@if (currSplitted.ParentArea != null && currSplitted.ParentWindow != null)
|
||||
{
|
||||
<AreaSplit SashList="SashList"
|
||||
SplittedList="SplittedList"
|
||||
CurrSplitted="currSplitted"
|
||||
EC_UpdateSplitted="UpdatePreviewSplitted">
|
||||
</AreaSplit>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (currStep == CompileStep.General)
|
||||
{
|
||||
<General CurrWindow="@m_CurrWindow"
|
||||
ListPayload="ListPayload"
|
||||
ListWarnings="listWarnings"
|
||||
EC_SelColor="SelectColor"
|
||||
EC_SelGlass="SelectGlass"
|
||||
EC_SelWindMat="SelectMat"
|
||||
EC_SelProfile="SelectProfile"
|
||||
<General CurrWindow="m_CurrWindow"
|
||||
ListPayload="ListPayload"
|
||||
ListWarnings="listWarnings"
|
||||
EC_UpdateGeneral="UpdatePreviewGeneral"
|
||||
EC_ReqClose="ReturnTree">
|
||||
</General>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (currStep != CompileStep.Template)
|
||||
{
|
||||
<div class="col-6">
|
||||
@outSvg
|
||||
</div>
|
||||
}
|
||||
<div class="col-md-12 col-lg-6 d-flex flex-column">
|
||||
@outSvg
|
||||
</div>
|
||||
if (listWarnings != null && listWarnings.Count > 0)
|
||||
{
|
||||
<div class="alert alert-warning">
|
||||
|
||||
+351
-481
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user