终端一体化运控平台
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

41 行
1010 B

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