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.
 
 

42 lines
947 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 HBLConsole.Service
  8. {
  9. public class RTrig
  10. {
  11. private volatile static ConcurrentDictionary<string, RTrig> _Instance;
  12. public static RTrig GetInstance(string name)
  13. {
  14. if (_Instance == null) _Instance = new ConcurrentDictionary<string, RTrig>();
  15. if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new RTrig());
  16. return _Instance[name];
  17. }
  18. private RTrig() { }
  19. private bool flag1;
  20. public bool Q { get; private set; }
  21. private bool IN1
  22. {
  23. set
  24. {
  25. Q = value && !flag1;
  26. flag1 = value;
  27. }
  28. }
  29. public bool Start(bool IN)
  30. {
  31. IN1 = IN;
  32. return Q;
  33. }
  34. }
  35. }