From 52bd4eb78570a69ef43f5025569331f7c05ecdae Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 10 May 2023 12:06:21 +0200 Subject: [PATCH] inizio gestione homeCard --- .../Components/SvgComp/HomeCard.razor | 27 +++ .../Components/SvgComp/HomeCard.razor.cs | 163 ++++++++++++++++++ 2 files changed, 190 insertions(+) create mode 100644 WebDoorCreator.UI/Components/SvgComp/HomeCard.razor create mode 100644 WebDoorCreator.UI/Components/SvgComp/HomeCard.razor.cs diff --git a/WebDoorCreator.UI/Components/SvgComp/HomeCard.razor b/WebDoorCreator.UI/Components/SvgComp/HomeCard.razor new file mode 100644 index 0000000..0668ec9 --- /dev/null +++ b/WebDoorCreator.UI/Components/SvgComp/HomeCard.razor @@ -0,0 +1,27 @@ + + + +
+ @foreach (var item in TextData) + { +
+ @item.Key +
+
+ @item.Value +
+ } +
+
+
+ + + + + + + + + + +
diff --git a/WebDoorCreator.UI/Components/SvgComp/HomeCard.razor.cs b/WebDoorCreator.UI/Components/SvgComp/HomeCard.razor.cs new file mode 100644 index 0000000..465c2e4 --- /dev/null +++ b/WebDoorCreator.UI/Components/SvgComp/HomeCard.razor.cs @@ -0,0 +1,163 @@ +using Microsoft.AspNetCore.Components; + +namespace WebDoorCreator.UI.Components.SvgComp +{ + public partial class HomeCard + { + #region Public Properties + + [Parameter] + public EventCallback EC_ExeFunct { get; set; } + + [Parameter] + public string ImagePath { get; set; } = "images/LogoEgw.png"; + + [Parameter] + public string LineColor { get; set; } = "#00838F"; + + [Parameter] + public int LineWidth { get; set; } = 8; + + [Parameter] + public int ObjH { get; set; } = 204; + + [Parameter] + public int ObjId { get; set; } = 0; + + [Parameter] + public int ObjW { get; set; } = 450; + + [Parameter] + public Dictionary TextData { get; set; } = new Dictionary(); + + [Parameter] + public string TextStyle { get; set; } = "font-size: 1.5em; fill: #000;"; + + [Parameter] + public string Message1 { get; set; } = ""; + [Parameter] + public string Message2 { get; set; } = ""; + + [Parameter] + public string LeftTextClass { get; set; } = ""; + [Parameter] + public string RightTextClass { get; set; } = ""; + + #endregion Public Properties + + #region Protected Properties + + protected LineData BaseLine { get; set; } = null!; + + protected CircleData CircleImg { get; set; } = null!; + + protected CircleData CircleLine { get; set; } = null!; + + protected int LineDist { get; set; } = 20; + + protected int TextAreaHeight + { + get => (ObjH * 96 / 100); + } + + protected int TextAreaWidth + { + get => ObjW - (ObjH * 120 / 100); + } + + #endregion Protected Properties + + #region Protected Methods + + protected void execFunc() + { + EC_ExeFunct.InvokeAsync(true); + } + + protected override void OnParametersSet() + { + setupGraphParams(); + } + + #endregion Protected Methods + + #region Protected Classes + + protected class CircleData + { + #region Public Constructors + + public CircleData(int px, int py, int radius) + { + cx = px; + cy = py; + rad = radius; + } + + #endregion Public Constructors + + #region Public Properties + + public int cx { get; set; } = 0; + public int cy { get; set; } = 0; + public int rad { get; set; } = 100; + + #endregion Public Properties + } + + protected class LineData + { + #region Public Constructors + + public LineData(PointData pA, PointData pB) + { + p1 = pA; + p2 = pB; + } + + #endregion Public Constructors + + #region Public Properties + + public PointData p1 { get; set; } + public PointData p2 { get; set; } + + #endregion Public Properties + } + + protected class PointData + { + #region Public Constructors + + public PointData(int valx, int valy) + { + px = valx; + py = valy; + } + + #endregion Public Constructors + + #region Public Properties + + public int px { get; set; } = 0; + public int py { get; set; } = 0; + + #endregion Public Properties + } + + #endregion Protected Classes + + #region Private Methods + + private void setupGraphParams() + { + // calcolo i dati del cerchi... + CircleLine = new CircleData(ObjW - LineWidth - (ObjH / 2), ObjH / 2, (ObjH - LineWidth) / 2); + CircleImg = new CircleData(ObjW - LineWidth - (ObjH / 2), ObjH / 2, (ObjH - 2 * LineWidth) / 2); + BaseLine = new LineData(new PointData(0, ObjH - LineWidth / 2), new PointData(ObjW - LineWidth - (ObjH / 2), ObjH - LineWidth / 2)); + LineDist = ObjH / 4; + } + + #endregion Private Methods + } +} \ No newline at end of file