终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

40 line
959 B

  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. }