IBroadcaster.cs 962 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Uestc.Auto6.Dso.Core
  7. {
  8. public interface IBroadcaster
  9. {
  10. event EventHandler<CustomEventArg>? PublisherChanged;
  11. static event EventHandler<CustomEventArg>? StaticPublisherChanged;
  12. virtual void OnRaiseCustomEvent(CustomEventArg e) { }
  13. static void OnRaiseStaticCustomEvent(CustomEventArg e)
  14. {
  15. EventHandler<CustomEventArg>? handler = StaticPublisherChanged;
  16. if (handler != null)
  17. {
  18. handler(e,e);
  19. }
  20. }
  21. }
  22. public class CustomEventArg : EventArgs
  23. {
  24. public CustomEventArg(String s)
  25. {
  26. Message = s;
  27. }
  28. private string message = "";
  29. public String Message
  30. {
  31. get { return message; }
  32. set { message = value; }
  33. }
  34. }
  35. }