Archived
Private
Public Access
1
0
This repository has been archived on 2026-02-04. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
ProjectBackup/C#/DigiSim/Logic/Input.cs
2022-09-04 12:45:01 +02:00

34 lines
976 B
C#

using System.Windows.Controls;
using System.Windows.Shapes;
namespace DigiSim.Logic {
public class Input : Gate {
public bool Powered;
protected override void InternalSetup(Canvas canvas) {
Shape = new Ellipse();
SetOutputs(1);
SetInputs(0);
CreateConnections();
Shape.MouseLeftButtonUp += (sender, args) => {
if (IsAttached) return;
Powered = !Powered;
Update(this);
};
Text = "I";
Instantiate();
}
public override void Update(Gate source) {
ConnectedOutputs[0].IsPowered = Powered;
Shape.Fill = Powered ? FromHex(Window.PoweredColor) : FromHex(Window.FillColor);
UpdateShapes();
UpdateConnectedGates(source);
}
public Input(double x, double y) : base(x, y, 20, 20) { }
}
}