You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 line
2.1 KiB

  1. using Stylet;
  2. using System.Windows;
  3. namespace HKCardIN.ViewModels
  4. {
  5. public class RootViewModel : Conductor<IScreen>
  6. {
  7. bool IsLocker = false;
  8. public RootViewModel()
  9. {
  10. CodeVisible = Visibility.Collapsed;
  11. ContentVisible = Visibility.Visible;
  12. }
  13. #region 属性
  14. decimal _ShowMoney;
  15. public decimal ShowMoney
  16. {
  17. get => _ShowMoney;
  18. set => SetAndNotify(ref _ShowMoney, value);
  19. }
  20. Visibility _ContentVisible;
  21. public Visibility ContentVisible
  22. {
  23. get => _ContentVisible;
  24. set => SetAndNotify(ref _ContentVisible, value);
  25. }
  26. Visibility _CodeVisible;
  27. public Visibility CodeVisible
  28. {
  29. get => _CodeVisible;
  30. set => SetAndNotify(ref _CodeVisible, value);
  31. }
  32. string _LockCode;
  33. public string LockCode
  34. {
  35. get => _LockCode;
  36. set => SetAndNotify(ref _LockCode, value);
  37. }
  38. string _InputMoney;
  39. public string InputMoney
  40. {
  41. get => _InputMoney;
  42. set
  43. {
  44. SetAndNotify(ref _InputMoney, value);
  45. decimal.TryParse(value, out decimal data);
  46. ShowMoney = data;
  47. }
  48. }
  49. #endregion
  50. #region 命令
  51. public void InputAction(string input)
  52. {
  53. if (IsLocker) return;
  54. ShowMoney = decimal.Parse(input);
  55. }
  56. public void LockSreenAction()
  57. {
  58. IsLocker = true;
  59. ContentVisible = Visibility.Collapsed;
  60. CodeVisible = Visibility.Visible;
  61. }
  62. public void UnLockAction()
  63. {
  64. if (LockCode.Equals("123"))
  65. {
  66. IsLocker = false;
  67. CodeVisible = Visibility.Collapsed;
  68. ContentVisible = Visibility.Visible;
  69. LockCode = string.Empty;
  70. }
  71. }
  72. public void ResetAction()
  73. {
  74. LockCode = string.Empty;
  75. }
  76. public void SaveAction()
  77. {
  78. }
  79. #endregion
  80. }
  81. }