163 lines
4.0 KiB
C#
163 lines
4.0 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace WebDoorCreator.UI.Components.SvgComp
|
|
{
|
|
public partial class HomeCard
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public EventCallback<bool> 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<string, string> TextData { get; set; } = new Dictionary<string, string>();
|
|
|
|
[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
|
|
}
|
|
} |