PosObServer.cs 833 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using XdCxRhDW.Repostory.Model;
  7. namespace XdCxRhDW.Core.ObServer
  8. {
  9. public class PosObServer
  10. {
  11. private static PosObServer _ins =new PosObServer();
  12. private PosObServer()
  13. {
  14. }
  15. public static PosObServer Instance => _ins;
  16. /// <summary>
  17. /// 定位推送事件
  18. /// </summary>
  19. public event Action<PosRes> OnPosChanged;
  20. public void Sub(Action<PosRes> action)
  21. {
  22. OnPosChanged += action;
  23. }
  24. public void DisposeSub(Action<PosRes> action)
  25. {
  26. OnPosChanged -= action;
  27. }
  28. public void Pub(PosRes data)
  29. {
  30. OnPosChanged?.Invoke(data);
  31. }
  32. }
  33. }