Aggiornato gestione AGBOptionText

This commit is contained in:
Annamaria Sassi
2025-10-27 16:32:07 +01:00
parent f187bbe5c5
commit 960d20e256
11 changed files with 164 additions and 40 deletions
+2 -13
View File
@@ -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
+2 -1
View File
@@ -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("", "");
+50 -2
View File
@@ -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
}
}
+10 -10
View File
@@ -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;
}
}