EditTLWindow.xaml.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using ivf_tl_Entity.Entity;
  2. using ivf_tl_Manage.Converts;
  3. using ivf_tl_Manage.ViewModels.Win;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Shapes;
  17. namespace ivf_tl_Manage.Win
  18. {
  19. /// <summary>
  20. /// EditTLWindow.xaml 的交互逻辑
  21. /// </summary>
  22. public partial class EditTLWindow : Window
  23. {
  24. private EditTLWindowViewModel vm = null;
  25. public EditTLWindow( long id,Window w)
  26. {
  27. InitializeComponent();
  28. this.Owner = w;
  29. vm = new EditTLWindowViewModel(id);
  30. this.DataContext= vm;
  31. this.Loaded += EditTLWindow_Loaded;
  32. }
  33. private void EditTLWindow_Loaded(object sender, RoutedEventArgs e)
  34. {
  35. if(vm.TLSettingInfo != null)
  36. {
  37. switch (vm.TLSettingInfo.online)
  38. {
  39. case 0:
  40. this._onLine0_RadioButton.IsChecked = true;
  41. break;
  42. case 1:
  43. this._onLine1_RadioButton.IsChecked = true;
  44. break;
  45. case 2:
  46. this._onLine2_RadioButton.IsChecked = true;
  47. break;
  48. }
  49. }
  50. }
  51. private void Cancel_Click(object sender, RoutedEventArgs e)
  52. {
  53. this.DialogResult = false;
  54. }
  55. private void Ok_Click(object sender, RoutedEventArgs e)
  56. {
  57. if (string.IsNullOrEmpty(vm.TLSettingInfo.tlName))
  58. {
  59. //MessageBoxShow("设备名称不能为空");
  60. MessageBoxShow(KeyToStringConvert.GetLanguageStringByKey("0188"));
  61. return;
  62. }
  63. if (string.IsNullOrEmpty(vm.TLSettingInfo.installTime))
  64. {
  65. //MessageBoxShow("安装日期不能为空");
  66. MessageBoxShow(KeyToStringConvert.GetLanguageStringByKey("0198"));
  67. return;
  68. }
  69. if (string.IsNullOrEmpty(vm.TLSettingInfo.address))
  70. {
  71. //MessageBoxShow("安装地址不能为空");
  72. MessageBoxShow(KeyToStringConvert.GetLanguageStringByKey("0268"));
  73. return;
  74. }
  75. if (string.IsNullOrEmpty(vm.TLSettingInfo.remark))
  76. {
  77. //MessageBoxShow("医院名称不能为空");
  78. MessageBoxShow(KeyToStringConvert.GetLanguageStringByKey("0199"));
  79. return;
  80. }
  81. if (string.IsNullOrEmpty(vm.TLSettingInfo.collectSn))
  82. {
  83. //MessageBoxShow("温度设备编号不能为空");
  84. MessageBoxShow(KeyToStringConvert.GetLanguageStringByKey("0191"));
  85. return;
  86. }
  87. string error = vm.SaveTlInfo();
  88. if (!string.IsNullOrEmpty(error))
  89. {
  90. //MessageBoxShow($"操作失败:{error}");
  91. MessageBoxShow($"{KeyToStringConvert.GetLanguageStringByKey("0286")}:{error}");
  92. return;
  93. }
  94. this.DialogResult = true;
  95. return;
  96. }
  97. private void MessageBoxShow(string mess)
  98. {
  99. this._message.Text = mess;
  100. }
  101. private void AddressSelectUserControl_SelectValue(string value)
  102. {
  103. // vm.TLSettingInfo.address = value;
  104. }
  105. private void Cancel_MouseUp(object sender, MouseButtonEventArgs e)
  106. {
  107. this.DialogResult = false;
  108. return;
  109. }
  110. }
  111. }