ExportDishWindow.xaml.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. using ivf_tl_Entity.Enums;
  2. using ivf_tl_Entity.Response;
  3. using ivf_tl_Manage.Converts;
  4. using ivf_tl_Manage.ViewModels;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Reflection.Metadata;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows;
  12. using System.Windows.Controls;
  13. using System.Windows.Data;
  14. using System.Windows.Documents;
  15. using System.Windows.Input;
  16. using System.Windows.Media;
  17. using System.Windows.Media.Imaging;
  18. using System.Windows.Shapes;
  19. namespace ivf_tl_Manage.Win
  20. {
  21. /// <summary>
  22. /// ExportDishWindow.xaml 的交互逻辑
  23. /// </summary>
  24. public partial class ExportDishWindow : Window
  25. {
  26. ExportDishResponse exportDishResponse;
  27. public ExportDishWindow(ExportDishResponse exportDishResponse1)
  28. {
  29. InitializeComponent();
  30. exportDishResponse = exportDishResponse1;
  31. this.Owner = AppData.Instance.MainWindow;
  32. Closed += (s, e) => AppData.Instance.MainWindow.Activate();
  33. }
  34. private void MessageBoxShow(string mess)
  35. {
  36. this.message.Text = mess;
  37. }
  38. private void ExLog(Exception ex, string name)
  39. {
  40. AppData.Instance.LogService.ExceptionLog(ex, $"ExportDishWindow.{name}", LogEnum.RunException);
  41. }
  42. private void ErrorLog(string message, LogEnum logType)
  43. {
  44. AppData.Instance.LogService.TLLog($"ExportDishWindow.{message}", logType);
  45. }
  46. private void Cancel_MouseUp(object sender, MouseButtonEventArgs e)
  47. {
  48. this.DialogResult = false;
  49. return;
  50. }
  51. private void Ok_Click(object sender, RoutedEventArgs e)
  52. {
  53. if (this._rem_CheckBox1.IsChecked == false &&
  54. this._len_CheckBox1.IsChecked == false &&
  55. this._fei_CheckBox1.IsChecked == false &&
  56. this._san_CheckBox1.IsChecked == false &&
  57. this._wei_CheckBox1.IsChecked == false)
  58. {
  59. MessageBoxShow("至少选择一个去向");
  60. return;
  61. }
  62. string dirName = this._dirName_TextBox.Text.Trim();
  63. if (string.IsNullOrEmpty(dirName))
  64. {
  65. MessageBoxShow(KeyToStringConvert.GetLanguageStringByKey("0618"));
  66. return;
  67. }
  68. exportDishResponse.tlSn = dirName;
  69. if (this._rem_CheckBox1.IsChecked == true) exportDishResponse.transplant = true;
  70. if (this._len_CheckBox1.IsChecked == true) exportDishResponse.freezing = true;
  71. if (this._fei_CheckBox1.IsChecked == true) exportDishResponse.invalid = true;
  72. if (this._san_CheckBox1.IsChecked == true) exportDishResponse.deleted = true;
  73. if (this._wei_CheckBox1.IsChecked == true) exportDishResponse.unmark = true;
  74. this.DialogResult = true;
  75. return;
  76. }
  77. private void Cancel_Click(object sender, RoutedEventArgs e)
  78. {
  79. this.DialogResult = false;
  80. return;
  81. }
  82. private void SelectDir_Click(object sender, RoutedEventArgs e)
  83. {
  84. var dialog = new System.Windows.Forms.FolderBrowserDialog();
  85. if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  86. {
  87. this._dirName_TextBox.Text = dialog.SelectedPath;
  88. }
  89. }
  90. bool isChildren = false;
  91. private void setParent(bool b)
  92. {
  93. if (!b)
  94. {
  95. isChildren = true;
  96. this._all_CheckBox1.IsChecked = b;
  97. isChildren = false;
  98. return;
  99. }
  100. if (this._rem_CheckBox1.IsChecked == b &&
  101. this._len_CheckBox1.IsChecked == b &&
  102. this._fei_CheckBox1.IsChecked == b &&
  103. this._san_CheckBox1.IsChecked == b &&
  104. this._wei_CheckBox1.IsChecked == b)
  105. {
  106. isChildren = true;
  107. this._all_CheckBox1.IsChecked = b;
  108. isChildren = false;
  109. }
  110. return;
  111. }
  112. private void SetChildren(bool b)
  113. {
  114. this._rem_CheckBox1.IsChecked = b;
  115. this._len_CheckBox1.IsChecked = b;
  116. this._fei_CheckBox1.IsChecked = b;
  117. this._san_CheckBox1.IsChecked = b;
  118. this._wei_CheckBox1.IsChecked = b;
  119. }
  120. private void All_UnChecked(object sender, RoutedEventArgs e)
  121. {
  122. if (!this.IsLoaded || !this._all_CheckBox1.IsLoaded || isChildren) return;
  123. SetChildren(false);
  124. }
  125. private void All_Checked(object sender, RoutedEventArgs e)
  126. {
  127. if (!this.IsLoaded || !this._all_CheckBox1.IsLoaded || isChildren) return;
  128. SetChildren(true);
  129. }
  130. private void Rem_Checked(object sender, RoutedEventArgs e)
  131. {
  132. if (!this.IsLoaded || !this._rem_CheckBox1.IsLoaded) return;
  133. setParent(true);
  134. }
  135. private void Rem_UnChecked(object sender, RoutedEventArgs e)
  136. {
  137. if (!this.IsLoaded || !this._rem_CheckBox1.IsLoaded) return;
  138. setParent(false);
  139. }
  140. private void Len_Checked(object sender, RoutedEventArgs e)
  141. {
  142. if (!this.IsLoaded || !this._len_CheckBox1.IsLoaded) return;
  143. setParent(true);
  144. }
  145. private void Len_UnChecked(object sender, RoutedEventArgs e)
  146. {
  147. if (!this.IsLoaded || !this._len_CheckBox1.IsLoaded) return;
  148. setParent(false);
  149. }
  150. private void Fei_Checked(object sender, RoutedEventArgs e)
  151. {
  152. if (!this.IsLoaded || !this._fei_CheckBox1.IsLoaded) return;
  153. setParent(true);
  154. }
  155. private void Fei_UnChecked(object sender, RoutedEventArgs e)
  156. {
  157. if (!this.IsLoaded || !this._fei_CheckBox1.IsLoaded) return;
  158. setParent(false);
  159. }
  160. private void San_UnChecked(object sender, RoutedEventArgs e)
  161. {
  162. if (!this.IsLoaded || !this._san_CheckBox1.IsLoaded) return;
  163. setParent(false);
  164. }
  165. private void San_Checked(object sender, RoutedEventArgs e)
  166. {
  167. if (!this.IsLoaded || !this._san_CheckBox1.IsLoaded) return;
  168. setParent(true);
  169. }
  170. private void Wei_UnChecked(object sender, RoutedEventArgs e)
  171. {
  172. if (!this.IsLoaded || !this._wei_CheckBox1.IsLoaded) return;
  173. setParent(false);
  174. }
  175. private void Wei_Checked(object sender, RoutedEventArgs e)
  176. {
  177. if (!this.IsLoaded || !this._wei_CheckBox1.IsLoaded) return;
  178. setParent(true);
  179. }
  180. }
  181. }