|
- using Stylet;
- using System.Windows;
-
- namespace HKCardIN.ViewModels
- {
- public class RootViewModel : Conductor<IScreen>
- {
- bool IsLocker = false;
-
- public RootViewModel()
- {
- CodeVisible = Visibility.Collapsed;
- ContentVisible = Visibility.Visible;
- }
-
- #region 属性
- decimal _ShowMoney;
- public decimal ShowMoney
- {
- get => _ShowMoney;
- set => SetAndNotify(ref _ShowMoney, value);
- }
- Visibility _ContentVisible;
- public Visibility ContentVisible
- {
- get => _ContentVisible;
- set => SetAndNotify(ref _ContentVisible, value);
- }
- Visibility _CodeVisible;
- public Visibility CodeVisible
- {
- get => _CodeVisible;
- set => SetAndNotify(ref _CodeVisible, value);
- }
- string _LockCode;
- public string LockCode
- {
- get => _LockCode;
- set => SetAndNotify(ref _LockCode, value);
- }
- string _InputMoney;
- public string InputMoney
- {
- get => _InputMoney;
- set
- {
- SetAndNotify(ref _InputMoney, value);
- decimal.TryParse(value, out decimal data);
- ShowMoney = data;
- }
- }
- #endregion
-
- #region 命令
- public void InputAction(string input)
- {
- if (IsLocker) return;
- ShowMoney = decimal.Parse(input);
- }
- public void LockSreenAction()
- {
- IsLocker = true;
- ContentVisible = Visibility.Collapsed;
- CodeVisible = Visibility.Visible;
- }
- public void UnLockAction()
- {
- if (LockCode.Equals("123"))
- {
- IsLocker = false;
- CodeVisible = Visibility.Collapsed;
- ContentVisible = Visibility.Visible;
- LockCode = string.Empty;
- }
- }
- public void ResetAction()
- {
- LockCode = string.Empty;
- }
- public void SaveAction()
- {
-
- }
- #endregion
- }
- }
|