MessagePrompt.xaml.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. using ivf_tl_Manage.Converts;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Shapes;
  15. namespace ivf_tl_Manage.Win
  16. {
  17. /// <summary>
  18. /// MessagePrompt.xaml 的交互逻辑
  19. /// </summary>
  20. public partial class MessagePrompt : Window
  21. {
  22. private Window parent = null;
  23. public MessagePrompt()
  24. {
  25. InitializeComponent();
  26. this.Closed += (a, b) =>
  27. {
  28. if (parent != null)
  29. {
  30. parent.Activate();
  31. }
  32. };
  33. }
  34. public bool? ShowEmbryoOper(string tag, string mess, int typeState)
  35. {
  36. this.Owner = AppData.Instance.MainWindow;
  37. this.parent = AppData.Instance.MainWindow;
  38. if (tag == "完成")
  39. {
  40. TitleString = KeyToStringConvert.GetLanguageStringByKey("0517");
  41. }
  42. else
  43. {
  44. TitleString = tag;
  45. }
  46. MessageInfoString = mess;
  47. switch (typeState)
  48. {
  49. case 1:
  50. if (tag == "取消" || tag == "完成")
  51. {
  52. //TitleString = "取消冷冻";
  53. TitleString = $"{KeyToStringConvert.GetLanguageStringByKey("0040")}";
  54. WidthVisibility = Visibility.Visible;
  55. }
  56. OperImageSource = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState1Icon.png", UriKind.Absolute));
  57. break;
  58. case 2:
  59. if (tag == "取消" || tag == "完成")
  60. {
  61. //TitleString = "取消移植";
  62. //TitleString = $"{KeyToStringConvert.GetLanguageStringByKey("0025")} {KeyToStringConvert.GetLanguageStringByKey("0041")}";
  63. TitleString = $"{KeyToStringConvert.GetLanguageStringByKey("0041")}";
  64. WidthVisibility = Visibility.Visible;
  65. }
  66. OperImageSource = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState2Icon.png", UriKind.Absolute));
  67. break;
  68. case 3:
  69. if (tag == "取消" || tag == "完成")
  70. {
  71. //TitleString = "取消作废";
  72. TitleString = $"{KeyToStringConvert.GetLanguageStringByKey("0042")}";
  73. WidthVisibility = Visibility.Visible;
  74. }
  75. OperImageSource = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState3Icon.png", UriKind.Absolute));
  76. break;
  77. case 4:
  78. if (tag == "取消" || tag == "完成")
  79. {
  80. //TitleString = "取消删除";
  81. TitleString = $"{KeyToStringConvert.GetLanguageStringByKey("0043")}";
  82. WidthVisibility = Visibility.Visible;
  83. }
  84. OperImageSource = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/EmbryoState4Icon.png", UriKind.Absolute));
  85. break;
  86. case 5:
  87. OperImageSource = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/DetailEndButtonIcon.png", UriKind.Absolute));
  88. break;
  89. }
  90. return this.ShowDialog();
  91. }
  92. private void Cancel_Click(object sender, RoutedEventArgs e)
  93. {
  94. this.DialogResult = false;
  95. }
  96. private void Ok_Click(object sender, RoutedEventArgs e)
  97. {
  98. this.DialogResult = true;
  99. }
  100. public string TitleString
  101. {
  102. get { return (string)GetValue(TitleStringProperty); }
  103. set { SetValue(TitleStringProperty, value); }
  104. }
  105. // Using a DependencyProperty as the backing store for TitleString. This enables animation, styling, binding, etc...
  106. public static readonly DependencyProperty TitleStringProperty =
  107. DependencyProperty.Register("TitleString", typeof(string), typeof(MessagePrompt), new PropertyMetadata(null));
  108. public string MessageInfoString
  109. {
  110. get { return (string)GetValue(MessageInfoStringProperty); }
  111. set { SetValue(MessageInfoStringProperty, value); }
  112. }
  113. // Using a DependencyProperty as the backing store for MessageInfoString. This enables animation, styling, binding, etc...
  114. public static readonly DependencyProperty MessageInfoStringProperty =
  115. DependencyProperty.Register("MessageInfoString", typeof(string), typeof(MessagePrompt), new PropertyMetadata(null));
  116. public ImageSource OperImageSource
  117. {
  118. get { return (ImageSource)GetValue(OperImageSourceProperty); }
  119. set { SetValue(OperImageSourceProperty, value); }
  120. }
  121. // Using a DependencyProperty as the backing store for OperImageSource. This enables animation, styling, binding, etc...
  122. public static readonly DependencyProperty OperImageSourceProperty =
  123. DependencyProperty.Register("OperImageSource", typeof(ImageSource), typeof(MessagePrompt), new PropertyMetadata(null));
  124. public Visibility WidthVisibility
  125. {
  126. get { return (Visibility)GetValue(WidthVisibilityProperty); }
  127. set { SetValue(WidthVisibilityProperty, value); }
  128. }
  129. // Using a DependencyProperty as the backing store for WidthVisibility. This enables animation, styling, binding, etc...
  130. public static readonly DependencyProperty WidthVisibilityProperty =
  131. DependencyProperty.Register("WidthVisibility", typeof(Visibility), typeof(MessagePrompt), new PropertyMetadata(Visibility.Hidden));
  132. }
  133. }