No puede seleccionar más de 25 temas
Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
|
- using BPASmartClient.CustomResource.Pages.Model;
- using BPASmartClient.CustomResource.Pages.View;
- using Microsoft.Toolkit.Mvvm.Input;
- 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 RelayCommand<object> ChangePasswardCommand { get; set; }
-
- public RelayCommand AddNewUserCommand { get; set; }
-
- public RelayCommand<object> DeleteUserCommand { get; set; }
-
- public RelayCommand<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 RelayCommand<object>(ChangePassward);
-
- AddNewUserCommand = new RelayCommand(() =>
- {
- AddNewUser addNewUser = new AddNewUser();
- addNewUser.ShowDialog();
- });
-
- DeleteUserCommand = new RelayCommand<object>(DeleteUser);
-
- EditUserConfigCommand = new RelayCommand<object>(EditUserConfig);
- }
-
- }
- }
|