EventProxy.cs 830 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. namespace ETModel
  4. {
  5. public class EventProxy: IEvent
  6. {
  7. public Action<List<object>> action;
  8. public List<object> param = new List<object>();
  9. public EventProxy(Action<List<object>> action)
  10. {
  11. this.action = action;
  12. }
  13. public void Handle()
  14. {
  15. this.param.Clear();
  16. this.action.Invoke(this.param);
  17. }
  18. public void Handle(object a)
  19. {
  20. this.param.Clear();
  21. this.param.Add(a);
  22. this.action.Invoke(this.param);
  23. }
  24. public void Handle(object a, object b)
  25. {
  26. this.param.Clear();
  27. this.param.Add(a);
  28. this.param.Add(b);
  29. this.action.Invoke(this.param);
  30. }
  31. public void Handle(object a, object b, object c)
  32. {
  33. this.param.Clear();
  34. this.param.Add(a);
  35. this.param.Add(b);
  36. this.param.Add(c);
  37. this.action.Invoke(this.param);
  38. }
  39. }
  40. }