InputTradePassWordViewModel.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using GalaSoft.MvvmLight;
  2. using GalaSoft.MvvmLight.Command;
  3. using Muchinfo.MTPClient.Data.Enums;
  4. using Muchinfo.MTPClient.Infrastructure.Helpers;
  5. using Muchinfo.MTPClient.Infrastructure.MessageBox;
  6. using Muchinfo.MTPClient.Infrastructure.Utilities;
  7. using Muchinfo.MTPClient.Resources;
  8. using Muchinfo.MTPClient.UI.Views;
  9. using Muchinfo.WPF.Controls.Windows;
  10. using System.Windows;
  11. namespace Muchinfo.MTPClient.UI.ViewModels
  12. {
  13. public class InputTradePassWordViewModel : ViewModelBase
  14. {
  15. #region Command
  16. public RelayCommand<InputTradePassWordView> ResetCommand
  17. {
  18. get
  19. {
  20. return new RelayCommand<InputTradePassWordView>((v) =>
  21. {
  22. TradePassWord = string.Empty;
  23. })
  24. ;
  25. }
  26. }
  27. public RelayCommand<InputTradePassWordView> ConfrimCommand
  28. {
  29. get
  30. {
  31. //判断
  32. return new RelayCommand<InputTradePassWordView>
  33. ((v) =>
  34. {
  35. string passWord = UserManager.CurrentTradeAccount.TradePassword;
  36. if (TradePassWord == passWord)
  37. {
  38. UserManager.MainPanelIsUnLock = true;
  39. v.Close();
  40. MessengerHelper.DefaultSend(UserManager.MainPanelIsUnLock, MessengerTokens.MainPanelIsUnlock);
  41. }
  42. else
  43. {
  44. UserManager.MainPanelIsUnLock = false;
  45. MessageBoxHelper.ShowInfo(Client_Resource.APP_WrongPassword, Client_Resource.APP_Tips);
  46. }
  47. });
  48. }
  49. }
  50. public RelayCommand CancleCommand
  51. {
  52. get
  53. {
  54. return new RelayCommand(() =>
  55. {
  56. var homePage = ViewModelLocator.MainPage;
  57. var messageResult = MessageBoxHelper.ShowQuestion(homePage, Client_Resource.UI2014_IsOrNotExit, Client_Resource.UI2014_Tips);
  58. if (messageResult == MessageBoxResult.Yes)
  59. {
  60. homePage.Close();
  61. }
  62. });
  63. }
  64. }
  65. #endregion
  66. #region Propreties
  67. /// <summary>
  68. /// 交易密码
  69. /// </summary>
  70. private string _tradePassWord;
  71. public string TradePassWord
  72. {
  73. get { return _tradePassWord; }
  74. set
  75. {
  76. Set(() => TradePassWord, ref _tradePassWord, value);
  77. }
  78. }
  79. #endregion
  80. }
  81. }