25'ten fazla konu seçemezsiniz
Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
|
- 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
- {
- private void CheckPassword(UserInfo userInfo)
- {
- if (userInfo.Password == OldPassword)
- {
- if (NewPassword1 == NewPassword2)
- {
- userInfo.Password = NewPassword2;
- int index = Array.FindIndex(Global.userManager.userInfos.ToArray(), p => p.UserName == userInfo.UserName);
- if (index >= 0 && index < Global.userManager.userInfos.Count)
- Global.userManager.userInfos.ElementAt(index).Password = NewPassword1;
- Config.GetInstance.SaveUser();
- ActionManage.GetInstance.Send("PasswordChangeViewconfirm");
- Global.changeUserInfo = null;
- }
- else
- {
- ErrorInfo = "新密码不匹配";
- }
- }
- else
- {
- ErrorInfo = "原密码错误";
- }
- }
-
- public PasswordChangeViewModel( )
- {
- LoginCommand = new RelayCommand(() =>
- {
- if (Global.changeUserInfo == null) CheckPassword(Global.userInfo);
- else { CheckPassword(Global.changeUserInfo); }
-
-
- });
-
- ExitCommand = new RelayCommand(() =>
- {
- ActionManage.GetInstance.Send("PasswordChangeViewCancel");
- Global.changeUserInfo = null;
- });
- }
-
- 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;
-
-
- }
- }
|