终端一体化运控平台
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
pirms 2 gadiem
12345678910111213141516171819202122232425262728293031323334353637383940
  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. }