WinMaintainerInfo.xaml.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. 
  2. ///////////////////////////////////////////////////////////////////////////////
  3. //文件名称: WinMaintainerInfo.xaml
  4. //文件描述: 维修商信息
  5. //创 建 者: xls
  6. //创建日期: 2018/5/24 22:07:12
  7. //版 本 号:1.0.0.0
  8. ////////////////////////////////////////////////////////////////////////////////
  9. using System;
  10. using System.Windows;
  11. using System.Windows.Input;
  12. using Com.FirmLib.UI.BllCommon;
  13. using FWindSoft.Wpf;
  14. using FWindSoft.Wpf.Controls;
  15. namespace Com.FirmLib.UI.Maintainer
  16. {
  17. /// <summary>
  18. /// WinMaintainerInfo.xaml 的交互逻辑
  19. /// </summary>
  20. public partial class WinMaintainerInfo : NChildWindow
  21. {
  22. private VmMaintainerInfo m_Vm;
  23. public WinMaintainerInfo():this(new VmMaintainerInfo())
  24. {
  25. InitializeComponent();
  26. }
  27. public WinMaintainerInfo(VmMaintainerInfo vm)
  28. {
  29. InitializeComponent();
  30. EveryTimeLoad = true;
  31. this.m_Vm = vm;
  32. this.m_Vm.SetRefView(this);
  33. this.DataContext = this.m_Vm;
  34. this.CommandBindings.Add(new CommandBinding(EditCommands.SingleUpdate, SingleUpdate));
  35. }
  36. protected override void LoadData(LoadParameter parameter)
  37. {
  38. //初始化列表数据
  39. m_Vm.Init(parameter);
  40. //加载醒目信息
  41. this.Title = this.m_Vm.Name;
  42. }
  43. #region 界面关联事件
  44. private void btnOK_Click(object sender, RoutedEventArgs e)
  45. {
  46. try
  47. {
  48. if (this.HasError())
  49. {
  50. //MessageShow.Infomation("请修改错误输入项");
  51. return;
  52. }
  53. //if (Execute())
  54. //{
  55. // MessageShow.Infomation("");
  56. // DialogResult = true;
  57. //}
  58. }
  59. catch (Exception ex)
  60. {
  61. //MessageShow.Show(ex);
  62. }
  63. }
  64. private void btnCancel_Click(object sender, RoutedEventArgs e)
  65. {
  66. Close();
  67. }
  68. #endregion
  69. #region 命令绑定相关
  70. void SingleUpdate(object sender, ExecutedRoutedEventArgs e)
  71. {
  72. TextBoxEditor editor = e.Parameter as TextBoxEditor;
  73. if (editor == null)
  74. return;
  75. string field = string.Empty;
  76. if (editor.Tag != null)
  77. {
  78. field = editor.Tag.ToString();
  79. }
  80. bool result = this.m_Vm.SingleUpdateVenderItem(field);
  81. if (!result)
  82. {
  83. //editor.Focus();
  84. editor.IsEditing = true;
  85. }
  86. }
  87. #endregion
  88. }
  89. }