using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using SubCabinetSolution.Model; using SubCabinetSolution.Utils; using SubCabinetSolution.Views; namespace SubCabinetSolution.ViewModel { public class EditUserDialogViewModel : ViewModelBase { public List<AdminFuncModel> AdminFuncModels { get; set; } public RelayCommand<Window> CloseWindowCommand { get; set; } public RelayCommand<object> ItemSelectedCommand { get; set; } public EditUserDialogViewModel() { AdminFuncModels = DataModelCreator.CreateAdminFuncModels(); CloseWindowCommand = new RelayCommand<Window>(CloseWindow); ItemSelectedCommand = new RelayCommand<object>(ItemSelectionChanged); } private void CloseWindow(Window window) { window.Close(); } private void ItemSelectionChanged(object sender) { var listBox = (ListBox)sender; if (listBox.SelectedIndex == -1) { return; } switch (listBox.SelectedIndex) { case 0: //角色转换 break; case 1: //人脸登记 new RegisterFaceWindow().ShowDialog(); break; case 2: //登记卡号 break; case 3: //重置密码 break; case 4: //删除用户 break; case 5: //锁定用户 break; case 6: //解除锁定 break; case 7: //解除人脸 break; } listBox.SelectedIndex = -1; } } }