Aggiunto componente semplificato (per utente base)
This commit is contained in:
+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>();
|
||||
|
||||
Reference in New Issue
Block a user