BusyIndicateableUiViewModelBase.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using System.Windows.Controls;
  3. namespace MECF.Framework.UI.Client.ClientBase
  4. {
  5. public class BusyIndicateableUiViewModelBase : UiViewModelBase
  6. {
  7. #region Variables
  8. private bool _isBusy;
  9. private string _busyIndicatorMessage;
  10. #endregion
  11. #region Properties
  12. /// <summary>
  13. /// 返回ViewModel绑定的视图对象。
  14. /// </summary>
  15. public UserControl View { get; private set; }
  16. /// <summary>
  17. /// 设置或返回忙信息。
  18. /// </summary>
  19. public string BusyIndicatorContent
  20. {
  21. get => _busyIndicatorMessage;
  22. set
  23. {
  24. _busyIndicatorMessage = value;
  25. NotifyOfPropertyChange(nameof(BusyIndicatorContent));
  26. }
  27. }
  28. /// <summary>
  29. /// 设置或返回视图是否正忙。
  30. /// </summary>
  31. public bool IsBusy
  32. {
  33. get => _isBusy;
  34. set
  35. {
  36. _isBusy = value;
  37. NotifyOfPropertyChange(nameof(IsBusy));
  38. }
  39. }
  40. #endregion
  41. #region Methods
  42. protected override void OnViewLoaded(object _view)
  43. {
  44. base.OnViewLoaded(_view);
  45. View = (UserControl)_view;
  46. }
  47. /// <summary>
  48. /// 取消操作。
  49. /// </summary>
  50. /// <exception cref="NotImplementedException"></exception>
  51. public virtual void Cancel()
  52. {
  53. throw new NotImplementedException();
  54. }
  55. #endregion
  56. }
  57. }