Add press 1 and 2
This commit is contained in:
@@ -20,16 +20,19 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
public ISet<IEdge> Inputs { get; init; }
|
||||
public ISet<IEdge> Outputs { get; init; }
|
||||
|
||||
public int? CapacityLiters { get; set; }
|
||||
|
||||
protected Func<bool> CallbackIsFilled;
|
||||
protected Func<bool> CallbackIsFull;
|
||||
|
||||
private Shape? _rect;
|
||||
private TextBlock? _text;
|
||||
|
||||
public Tank(string label, double x, double y, Func<bool> cbFilled, Func<bool> cbFull) {
|
||||
public Tank(string label, double x, double y, int capacityLiters, Func<bool> cbFilled, Func<bool> cbFull) {
|
||||
CenterX = x;
|
||||
CenterY = y;
|
||||
Label = label;
|
||||
CapacityLiters = capacityLiters;
|
||||
CallbackIsFilled = cbFilled;
|
||||
CallbackIsFull = cbFull;
|
||||
Inputs = new HashSet<IEdge>();
|
||||
@@ -45,7 +48,7 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
Fill = Brushes.WhiteSmoke,
|
||||
};
|
||||
_text = new() {
|
||||
Text = Label,
|
||||
Text = CapacityLiters.HasValue ? $"{Label}\n{CapacityLiters:N0}" : Label,
|
||||
FontSize = 12,
|
||||
Width = WIDTH,
|
||||
TextAlignment = TextAlignment.Center,
|
||||
@@ -54,7 +57,7 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
_rect.SetValue(Canvas.LeftProperty, CenterX - WIDTH / 2);
|
||||
_rect.SetValue(Canvas.TopProperty, CenterY - HEIGHT / 2);
|
||||
_text.SetValue(Canvas.LeftProperty, CenterX - WIDTH / 2);
|
||||
_text.SetValue(Canvas.TopProperty, CenterY - 8);
|
||||
_text.SetValue(Canvas.TopProperty, CenterY - (CapacityLiters.HasValue ? 16 : 8));
|
||||
canvas.Children.Add(_rect);
|
||||
canvas.Children.Add(_text);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user