MessageBoxHelper.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //using System.Windows;
  2. //using System.Windows.Media;
  3. //namespace Muchinfo.WPF.Controls.Windows
  4. //{
  5. // public class MessageBoxHelper
  6. // {
  7. // /// <summary>
  8. // /// 显示成功信息
  9. // /// </summary>
  10. // /// <param name="message">提示信息</param>
  11. // /// <param name="caption">标题</param>
  12. // /// <param name="isLogin">if set to <c>true</c> [is login].</param>
  13. // /// <returns>MessageBoxResult.</returns>
  14. // public static MessageBoxResult ShowSuccess(string message, string caption, bool isLogin = false)
  15. // {
  16. // return ShowSuccess(Application.Current.MainWindow, message, caption, isLogin);
  17. // }
  18. // /// <summary>
  19. // /// Shows the success.
  20. // /// </summary>
  21. // /// <param name="owner">The owner.</param>
  22. // /// <param name="message">The message.</param>
  23. // /// <param name="caption">The caption.</param>
  24. // /// <param name="isLogin">if set to <c>true</c> [is login].</param>
  25. // /// <returns>MessageBoxResult.</returns>
  26. // public static MessageBoxResult ShowSuccess(Window owner, string message, string caption, bool isLogin = false)
  27. // {
  28. // var background = GetBackground(isLogin);
  29. // return MuchinfoMessageBox.Show(owner, message, caption, MessageBoxButton.OK, MessageBoxImage.Information, background);
  30. // }
  31. // /// <summary>
  32. // /// 显示提示信息
  33. // /// </summary>
  34. // /// <param name="message">提示信息</param>
  35. // /// <param name="caption">标题</param>
  36. // /// <param name="isLogin">if set to <c>true</c> [is login].</param>
  37. // /// <returns>MessageBoxResult.</returns>
  38. // public static MessageBoxResult ShowInfo(string message, string caption, bool isLogin = false)
  39. // {
  40. // return ShowInfo(Application.Current.MainWindow, message, caption, isLogin);
  41. // }
  42. // /// <summary>
  43. // /// Shows the information.
  44. // /// </summary>
  45. // /// <param name="owner">The owner.</param>
  46. // /// <param name="message">The message.</param>
  47. // /// <param name="caption">The caption.</param>
  48. // /// <param name="isLogin">if set to <c>true</c> [is login].</param>
  49. // /// <returns>MessageBoxResult.</returns>
  50. // public static MessageBoxResult ShowInfo(Window owner, string message, string caption, bool isLogin = false)
  51. // {
  52. // var background = GetBackground(isLogin);
  53. // return MuchinfoMessageBox.Show(owner, message, caption, MessageBoxButton.OK, MessageBoxImage.Warning, background);
  54. // }
  55. // /// <summary>
  56. // /// 显示选择信息
  57. // /// </summary>
  58. // /// <param name="message">提示信息</param>
  59. // /// <param name="caption">标题</param>
  60. // /// <param name="isLogin">if set to <c>true</c> [is login].</param>
  61. // /// <returns>System.Windows.MessageBoxResult.</returns>
  62. // public static MessageBoxResult ShowQuestion(string message, string caption, bool isLogin = false)
  63. // {
  64. // return ShowQuestion(Application.Current.MainWindow, message, caption, isLogin);
  65. // }
  66. // /// <summary>
  67. // /// Shows the question.
  68. // /// </summary>
  69. // /// <param name="owner">The owner.</param>
  70. // /// <param name="message">The message.</param>
  71. // /// <param name="caption">The caption.</param>
  72. // /// <param name="isLogin">if set to <c>true</c> [is login].</param>
  73. // /// <returns>MessageBoxResult.</returns>
  74. // public static MessageBoxResult ShowQuestion(Window owner, string message, string caption, bool isLogin = false)
  75. // {
  76. // var background = GetBackground(isLogin);
  77. // return MuchinfoMessageBox.Show(owner, message, caption, MessageBoxButton.YesNo, MessageBoxImage.Question, background);
  78. // }
  79. // private static Brush GetBackground(bool isLogin)
  80. // {
  81. // return GetFromeResource<SolidColorBrush>(isLogin ? "MuchinfoBrush3" : "MuchinfoBrush6");
  82. // }
  83. // private static T GetFromeResource<T>(string resourceName) where T : class
  84. // {
  85. // try
  86. // {
  87. // var brush = (T)Application.Current.TryFindResource(resourceName);
  88. // if (brush == null) return default(T);
  89. // return brush;
  90. // }
  91. // catch
  92. // {
  93. // return null;
  94. // }
  95. // }
  96. // }
  97. //}