MessageShowBase.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* ==============================================================================
  2. * 功能描述:MessageShow
  3. * 创 建 者:SAGACLOUD
  4. * 创建日期:2017/8/25 9:29:57
  5. * ==============================================================================*/
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Windows.Forms;
  9. namespace SAGA.DotNetUtils.Others
  10. {
  11. /// <summary>
  12. /// MessageShow
  13. /// </summary>
  14. public class MessageShowBase
  15. {
  16. public static bool Confirm(string strText)
  17. {
  18. return (MessageBox.Show(strText, "上格云技术", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK);
  19. }
  20. public static bool ConfirmYesNo(string strText)
  21. {
  22. return (MessageBox.Show(strText, "上格云技术", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes);
  23. }
  24. public static void Error(string strText)
  25. {
  26. MessageBox.Show(strText, "上格云技术", MessageBoxButtons.OK, MessageBoxIcon.Hand);
  27. }
  28. public static void Infomation(List<string> listText)
  29. {
  30. if ((listText != null) && (listText.Count != 0))
  31. {
  32. string strText = "";
  33. foreach (string str2 in listText)
  34. {
  35. strText = strText + str2 + Environment.NewLine;
  36. }
  37. Infomation(strText);
  38. }
  39. }
  40. public static void Infomation(string strText)
  41. {
  42. MessageBox.Show(strText, "上格云技术", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  43. }
  44. public static bool Question(string strText)
  45. {
  46. return (MessageBox.Show(strText, "上格云技术", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes);
  47. }
  48. public static DialogResult Question2(string strText)
  49. {
  50. return MessageBox.Show(strText, "上格云技术", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
  51. }
  52. public static bool Retry(string strText)
  53. {
  54. return (MessageBox.Show(strText, "上格云技术", MessageBoxButtons.RetryCancel, MessageBoxIcon.Question) == DialogResult.Retry);
  55. }
  56. public static void Show(Exception ex)
  57. {
  58. MessageBox.Show(ex.Message + ex.StackTrace);
  59. }
  60. }
  61. }