Files
pamhagen-sysctrl/PamhagenSysCtrl/Helpers/Pipeline/ExternalValve.cs
T
2026-10-16 10:26:17 +02:00

30 lines
1.1 KiB
C#

using System.Windows;
using System.Windows.Media;
namespace PamhagenSysCtrl.Helpers.Pipeline {
public class ExternalValve : Valve {
public override string Label { get; }
public ExternalValve(string label, double x, double y, int orientation, Func<bool?> cbOpen) :
base(x, y, orientation, cbOpen) {
Label = label;
}
public override void Update(bool isHovering, bool isPressed) {
_text?.Visibility = isHovering || (App.Plant?.ManualControlMode ?? false) ? Visibility.Visible : Visibility.Hidden;
_triangles?.Fill =
!IsOpen ? PamhagenBrushes.Red :
IsOpen ? PamhagenBrushes.Green :
Highlight ?? Brushes.DarkGray;
if (!IsClosed) {
_topLine?.Points[1] = _middlePoints.Open.Top;
_bottomLine?.Points[1] = _middlePoints.Open.Bottom;
} else {
_topLine?.Points[1] = _middlePoints.Closed.Top;
_bottomLine?.Points[1] = _middlePoints.Closed.Bottom;
}
}
}
}