48 lines
950 B
C#
48 lines
950 B
C#
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()//下降沿
|
|
{
|
|
if (!Value &&_previousValue)
|
|
{
|
|
OnRisingEdge?.Invoke();
|
|
}
|
|
_previousValue = Value;
|
|
}
|
|
}
|
|
|
|
}
|