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.
|
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.Helper;
- using Microsoft.Toolkit.Mvvm.ComponentModel;
- using Microsoft.Toolkit.Mvvm.Input;
-
- namespace BPASmartClient.CustomResource.Pages.ViewModel
- {
- public class PasswordChangeViewModel : ObservableObject
- {
- public PasswordChangeViewModel()
- {
- LoginCommand = new RelayCommand(() =>
- {
- if (Global.userInfo.Password == OldPassword)
- {
- if (NewPassword1 == NewPassword2)
- {
- Global.userInfo.Password = NewPassword2;
- int index = Array.FindIndex(Global.userManager.userInfos.ToArray(), p => p.UserName == Global.userInfo.UserName);
- if (index >= 0 && index < Global.userManager.userInfos.Count)
- Global.userManager.userInfos.ElementAt(index).Password = NewPassword1;
- Config.GetInstance.SaveUser();
- ActionManage.GetInstance.Send("PasswordChangeViewconfirm");
- }
- else
- {
- ErrorInfo = "新密码不匹配";
- }
- }
- else
- {
- ErrorInfo = "原密码错误";
- }
- });
-
- ExitCommand = new RelayCommand(() =>
- {
- ActionManage.GetInstance.Send("PasswordChangeViewCancel");
- });
- }
-
- public RelayCommand LoginCommand { get; set; }
-
- public RelayCommand ExitCommand { get; set; }
-
-
-
- public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
- private string _mErrorInfo;
-
- public string OldPassword { get { return _mOldPassword; } set { _mOldPassword = value; OnPropertyChanged(); } }
- private string _mOldPassword;
-
-
- public string NewPassword1 { get { return _mNewPassword1; } set { _mNewPassword1 = value; OnPropertyChanged(); } }
- private string _mNewPassword1;
-
-
- public string NewPassword2 { get { return _mNewPassword2; } set { _mNewPassword2 = value; OnPropertyChanged(); } }
- private string _mNewPassword2;
-
-
- }
- }
|