RolePermissionEdit.xaml.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Shapes;
  13. using Triton160.UI.ViewModel;
  14. namespace Aitex.Triton160.UI.Views
  15. {
  16. /// <summary>
  17. /// Interaction logic for RolePermissionEdit.xaml
  18. /// </summary>
  19. public partial class RolePermissionEdit : Window
  20. {
  21. public RolePermissionEdit()
  22. {
  23. InitializeComponent();
  24. DataContext = roleViewModel;
  25. Loaded += new RoutedEventHandler(RolePermissionEdit_Loaded);
  26. roleViewModel.InitialRolePermissionVM();
  27. }
  28. void RolePermissionEdit_Loaded(object sender, RoutedEventArgs e)
  29. {
  30. //if (comboRoles.SelectedItem == null) { MessageBox.Show("请选择需要编辑的角色"); return; }
  31. roleViewModel.CurrentRoleName = comboRoles.SelectedValue + "";
  32. roleViewModel.BindAll();
  33. }
  34. RolePermissionViewModel roleViewModel = new RolePermissionViewModel();
  35. private void comboRoles_SelectionChanged(object sender, SelectionChangedEventArgs e)
  36. {
  37. string newrole = comboRoles.SelectedValue+"";
  38. if (!string.IsNullOrEmpty(newrole))
  39. roleViewModel.SelectRoleChanged(newrole);
  40. }
  41. }
  42. }