终端一体化运控平台
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TTrig.cs 959 B

2 년 전
123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections.Concurrent;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. namespace BPASmartClient.Helper
  6. {
  7. /// <summary>
  8. /// 下降沿操作
  9. /// </summary>
  10. public class TTrig
  11. {
  12. private volatile static ConcurrentDictionary<string, TTrig> _Instance;
  13. public static TTrig GetInstance(string name)
  14. {
  15. if (_Instance == null) _Instance = new ConcurrentDictionary<string, TTrig>();
  16. if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new TTrig());
  17. return _Instance[name];
  18. }
  19. private TTrig() { }
  20. private bool flag1;
  21. public bool Q { get; private set; }
  22. private bool IN1
  23. {
  24. set
  25. {
  26. Q = !value && flag1;
  27. flag1 = value;
  28. }
  29. }
  30. public bool Start(bool IN)
  31. {
  32. IN1 = IN;
  33. return Q;
  34. }
  35. }
  36. }