Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
|
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.CustomResource.Pages.View;
- using BPA.Helper;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace BPASmartClient.CustomResource.Pages.ViewModel
- {
- public class UserManagerViewModel
- {
- /// <summary>
- /// datagrid绑定
- /// </summary>
- public ObservableCollection<UserInfo> userManager { get; set; } = Global.userManager.userInfos;
-
-
- public BPARelayCommand<object> ChangePasswardCommand { get; set; }
-
- public BPARelayCommand AddNewUserCommand { get; set; }
-
- public BPARelayCommand<object> DeleteUserCommand { get; set; }
-
- public BPARelayCommand<object> EditUserConfigCommand { get; set; }
-
- private void ChangePassward(object o)
- {
- if (o != null && o is UserInfo infos)
- {
- Global.changeUserInfo = infos;
- PasswordChangeView passwordChangeView = new PasswordChangeView();
- passwordChangeView.ShowDialog();
- }
- }
-
- private void DeleteUser(object o)
- {
- if (o != null && o is UserInfo infos)
- {
- var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == infos.UserName);
- if (res != null) Global.userManager.userInfos.Remove(res);
- Config.GetInstance.SaveUser();
- }
- }
-
- private void EditUserConfig(object o)
- {
- if (o != null && o is UserInfo infos)
- {
- Global.changeUserInfo = null;
- Global.changeUserInfo = infos;
- UserConfigView userConfigView = new UserConfigView();
- userConfigView.ShowDialog();
- }
-
- }
-
- public UserManagerViewModel()
- {
- ChangePasswardCommand = new BPARelayCommand<object>(ChangePassward);
-
- AddNewUserCommand = new BPARelayCommand(() =>
- {
- AddNewUser addNewUser = new AddNewUser();
- addNewUser.ShowDialog();
- });
-
- DeleteUserCommand = new BPARelayCommand<object>(DeleteUser);
-
- EditUserConfigCommand = new BPARelayCommand<object>(EditUserConfig);
- }
-
- }
- }
|