Aggiornato gestione AGBOptionText
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
@using static WebWindowComplex.LayoutConst
|
||||
@using static WebWindowComplex.Json.WindowConst
|
||||
|
||||
<div class="card shadow-sm rounded mb-4">
|
||||
<div class="card-header bg-light bg-opacity-25">
|
||||
@@ -123,25 +123,22 @@
|
||||
<h6 class="fw-bold">Hardware option</h6>
|
||||
</div>
|
||||
</div>
|
||||
@if (CurrItem.HwdOptionList.Count > 0)
|
||||
@if (CurrItem.HwOptionList.Count > 0)
|
||||
{
|
||||
@foreach (var currOpt in CurrItem.HwdOptionList)
|
||||
@foreach (var currOpt in CurrItem.HwOptionList)
|
||||
{
|
||||
switch (currOpt.Type)
|
||||
{
|
||||
case AGBOption.HDWOPTIONTYPES.COMBO:
|
||||
case HwOptionTypes.COMBO:
|
||||
{
|
||||
AGBOptionCombo currOptCombo = (AGBOptionCombo)currOpt;
|
||||
<EditOptionCombo CurrOpt="currOptCombo" EC_Update="UpdateOpt"></EditOptionCombo>
|
||||
<EditOptionCombo CurrOpt="currOptCombo" EC_Update="UpdateOptCombo"></EditOptionCombo>
|
||||
break;
|
||||
}
|
||||
case AGBOption.HDWOPTIONTYPES.TEXT:
|
||||
case HwOptionTypes.TEXT:
|
||||
{
|
||||
AGBOptionText currOptText = (AGBOptionText)currOpt;
|
||||
<div class="input-group mb-2">
|
||||
<span class="input-group-text">@(currOptText.sName)</span>
|
||||
<input type="text" class="form-control" @bind="@currOptText.sValue">
|
||||
</div>
|
||||
<EditOptionText CurrOpt="currOptText" EC_Update="UpdateOptText"></EditOptionText>
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using WebWindowComplex.Models;
|
||||
using static WebWindowComplex.Json.WindowConst;
|
||||
|
||||
namespace WebWindowComplex.Compo
|
||||
{
|
||||
@@ -169,10 +170,27 @@ namespace WebWindowComplex.Compo
|
||||
/// </summary>
|
||||
/// <param name="updRec"></param>
|
||||
/// <returns></returns>
|
||||
private async Task UpdateOpt(AGBOptionCombo updRec)
|
||||
private async Task UpdateOptCombo(AGBOptionCombo updRec)
|
||||
{
|
||||
// cerco il record
|
||||
var currRec = CurrItem.HwdOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription);
|
||||
var currRec = CurrItem.HwOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription);
|
||||
// lo aggiorno
|
||||
if (updRec != null)
|
||||
{
|
||||
currRec = updRec;
|
||||
await EC_UpdateSash.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)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<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">@currValueCombo</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
@@ -0,0 +1,36 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using WebWindowComplex.Models;
|
||||
|
||||
namespace WebWindowComplex.Compo
|
||||
{
|
||||
public partial class EditOptionText
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public AGBOptionText CurrOpt { get; set; } = null!;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<AGBOptionText> EC_Update { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Properties
|
||||
|
||||
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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -110,6 +110,13 @@ namespace WebWindowComplex.Json
|
||||
HORIZONTAL = 2
|
||||
}
|
||||
|
||||
public enum HwOptionTypes : int
|
||||
{
|
||||
TEXT = 1,
|
||||
LENGHT = 2,
|
||||
COMBO = 3
|
||||
}
|
||||
|
||||
// Specifies the display state of an element.
|
||||
public enum Visibility
|
||||
{
|
||||
|
||||
@@ -20,17 +20,6 @@ namespace WebWindowComplex.Models
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Enums
|
||||
|
||||
public enum HDWOPTIONTYPES : int
|
||||
{
|
||||
TEXT = 1,
|
||||
LENGHT = 2,
|
||||
COMBO = 3
|
||||
}
|
||||
|
||||
#endregion Public Enums
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public Visibility OptVisibility
|
||||
@@ -57,7 +46,7 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
|
||||
public HDWOPTIONTYPES Type
|
||||
public HwOptionTypes Type
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -69,7 +58,7 @@ namespace WebWindowComplex.Models
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected HDWOPTIONTYPES m_Type;
|
||||
protected HwOptionTypes m_Type;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static WebWindowComplex.Json.WindowConst;
|
||||
|
||||
namespace WebWindowComplex.Models
|
||||
{
|
||||
@@ -12,7 +13,7 @@ namespace WebWindowComplex.Models
|
||||
|
||||
public AGBOptionCombo(ParametriOpzioniParametri HdwOptionParam) : base(HdwOptionParam)
|
||||
{
|
||||
m_Type = HDWOPTIONTYPES.COMBO;
|
||||
m_Type = HwOptionTypes.COMBO;
|
||||
foreach (var Value in HdwOptionParam.Opzioni)
|
||||
m_ValueList.Add(new AGBOptionParameter(Value.Valore, Value.DescrizioneOpzione));
|
||||
m_sValue = m_ValueList.FirstOrDefault(x => x.sValue == HdwOptionParam.ValoreCorrente) ?? new AGBOptionParameter("", "");
|
||||
|
||||
@@ -3,17 +3,55 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static WebWindowComplex.Json.WindowConst;
|
||||
|
||||
namespace WebWindowComplex.Models
|
||||
{
|
||||
//public class AGBOptionText : AGBOption
|
||||
//{
|
||||
// #region Public Constructors
|
||||
|
||||
// public AGBOptionText(ParametriOpzioniParametri HdwOptionParam) : base(HdwOptionParam)
|
||||
// {
|
||||
// m_Type = HdwOptionTypes.TEXT;
|
||||
// m_sValue = HdwOptionParam.ValoreCorrente;
|
||||
// }
|
||||
|
||||
// #endregion Public Constructors
|
||||
|
||||
// #region Public Properties
|
||||
|
||||
// public string sValue
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return m_sValue;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// m_sValue = value;
|
||||
// }
|
||||
// }
|
||||
|
||||
// #endregion Public Properties
|
||||
|
||||
// #region Private Fields
|
||||
|
||||
// private string m_sValue;
|
||||
|
||||
// #endregion Private Fields
|
||||
//}
|
||||
|
||||
public class AGBOptionText : AGBOption
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public AGBOptionText(ParametriOpzioniParametri HdwOptionParam) : base(HdwOptionParam)
|
||||
{
|
||||
m_Type = HDWOPTIONTYPES.TEXT;
|
||||
m_sValue = HdwOptionParam.ValoreCorrente;
|
||||
m_Type = HwOptionTypes.TEXT;
|
||||
foreach (var Value in HdwOptionParam.Opzioni)
|
||||
m_ValueList.Add(Value.Valore);
|
||||
m_sValue = m_ValueList.FirstOrDefault(x => x == HdwOptionParam.ValoreCorrente) ?? "";
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
@@ -32,12 +70,22 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> ValueList
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_ValueList;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string m_sValue;
|
||||
private List<string> m_ValueList = new List<string>();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
|
||||
}
|
||||
@@ -80,7 +80,7 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
}
|
||||
|
||||
public List<AGBOption> HwdOptionList
|
||||
public List<AGBOption> HwOptionList
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -478,7 +478,7 @@ namespace WebWindowComplex.Models
|
||||
/// </summary>
|
||||
public void ReqRefreshHwOption()
|
||||
{
|
||||
HwdOptionList.Clear();
|
||||
HwOptionList.Clear();
|
||||
// chiamata evento calcolo opzioni hardware
|
||||
OnReqHwOptionPreview(m_ParentWindow.sSerialized(), SelHardware.Id);
|
||||
}
|
||||
@@ -513,7 +513,7 @@ namespace WebWindowComplex.Models
|
||||
}
|
||||
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)
|
||||
if(!HardwareList.Contains(m_SelHardware) || m_SelHardware.Shape != m_CurrShape)
|
||||
SetFirstHardware();
|
||||
}
|
||||
|
||||
@@ -691,25 +691,25 @@ namespace WebWindowComplex.Models
|
||||
{
|
||||
if (!string.IsNullOrEmpty(OptionXml))
|
||||
{
|
||||
ParametriOpzioni HwdOptions = null;
|
||||
ParametriOpzioni HwOptions = null;
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(ParametriOpzioni));
|
||||
StringReader reader = new StringReader(OptionXml);
|
||||
HwdOptions = (ParametriOpzioni)serializer.Deserialize(reader);
|
||||
if (HwdOptions.Items != null)
|
||||
HwOptions = (ParametriOpzioni)serializer.Deserialize(reader);
|
||||
if (HwOptions.Items != null)
|
||||
{
|
||||
m_HwdOptionList.Clear();
|
||||
foreach (var HdwOption in HwdOptions.Items)
|
||||
foreach (var HwOption in HwOptions.Items)
|
||||
{
|
||||
switch (HdwOption.Tipo)
|
||||
switch (HwOption.Tipo)
|
||||
{
|
||||
case "Text":
|
||||
{
|
||||
m_HwdOptionList.Add(new AGBOptionText(HdwOption));
|
||||
m_HwdOptionList.Add(new AGBOptionText(HwOption));
|
||||
break;
|
||||
}
|
||||
case "List":
|
||||
{
|
||||
m_HwdOptionList.Add(new AGBOptionCombo(HdwOption));
|
||||
m_HwdOptionList.Add(new AGBOptionCombo(HwOption));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>2.7.10.2714</Version>
|
||||
<Version>2.7.10.2716</Version>
|
||||
<Authors>Annamaria Sassi</Authors>
|
||||
<Company>Egalware</Company>
|
||||
<Description>Componente gestione Configurazioni avanzate Window per LUX</Description>
|
||||
@@ -148,6 +148,14 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>2.7.10.2714</Version>
|
||||
<Version>2.7.10.2716</Version>
|
||||
<Authors>Annamaria Sassi</Authors>
|
||||
<Company>Egalware</Company>
|
||||
<Description>Componente gestione JWD per LUX</Description>
|
||||
@@ -205,6 +205,17 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user