Files
FullAutoWaterCheck/全自动水压检测仪/DATA/BoolSign.cs

48 lines
927 B
C#
Raw Normal View History

2026-01-07 13:42:17 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace .Data
{
//public class BoolSignal
//{
// private bool _previousValue;
// public event Action OnRisingEdge;
// public bool Value { get; set; }
// public void CheckRisingEdge()
// {
// if (Value && !_previousValue)
// {
// OnRisingEdge?.Invoke();
// }
// _previousValue = Value;
// }
//}
public class BoolSignal
{
private bool _previousValue;
public event Action OnRisingEdge;
public bool Value { get; set; }
public void CheckRisingEdge()
{
2026-01-19 17:50:49 +08:00
if (!Value &&_previousValue)
2026-01-07 13:42:17 +08:00
{
OnRisingEdge?.Invoke();
}
_previousValue = Value;
}
}
}