终端一体化运控平台
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 2 gadiem
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. }