MessageWindowBig.xaml.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Shapes;
  14. namespace NEIntelligentControl2.Windows
  15. {
  16. /// <summary>
  17. /// MessageWindowBig.xaml 的交互逻辑
  18. /// </summary>
  19. public partial class MessageWindowBig : Window
  20. {
  21. public string Message { get; set; }
  22. public MessageWindowBig()
  23. {
  24. InitializeComponent();
  25. }
  26. private void Button_Click(object sender, RoutedEventArgs e)
  27. {
  28. switch (((Control)sender).Tag)
  29. {
  30. case "cancel": // 取消
  31. DialogResult = false;
  32. break;
  33. case "ok": // 确认
  34. DialogResult = true;
  35. break;
  36. default: return;
  37. }
  38. }
  39. /// <summary>
  40. /// 显示提示窗口
  41. /// </summary>
  42. public static bool ShowMessage(string message, string title = "提示")
  43. {
  44. MessageWindowBig mw = new MessageWindowBig() { Message = message, Title = title };
  45. mw.Owner = Application.Current.MainWindow;
  46. var v = mw.ShowDialog();
  47. return v == true;
  48. }
  49. }
  50. }