BasePresenter.cs 776 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace efunbox_xyyf_windows.baseMvp
  8. {
  9. public class BasePresenter<V>
  10. {
  11. protected V mView;
  12. /**
  13. * 绑定view,一般在初始化中调用该方法
  14. *
  15. * @param view view
  16. */
  17. public void attachView(V view)
  18. {
  19. this.mView = view;
  20. }
  21. /**
  22. * 解除绑定view,一般在onDestroy中调用
  23. */
  24. public void detachView()
  25. {
  26. this.mView = default;
  27. }
  28. /**
  29. * View是否绑定
  30. *
  31. * @return
  32. */
  33. public bool isViewAttached()
  34. {
  35. return mView != null;
  36. }
  37. }
  38. }