MessageBox.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using BaseLibRWFile;
  2. using System;
  3. using System.Windows.Forms;
  4. namespace BaseLibRWFile
  5. {
  6. public class Msg
  7. {
  8. public static Log newLog = new Log();
  9. public static bool Show(string ChineseContent, string EnglishContent = "Null", string OtherContent = "Null",
  10. string caption = "提示", MessageBoxButtons msgbtn = MessageBoxButtons.OK,
  11. MessageBoxIcon msgicon = MessageBoxIcon.Warning,bool bHelpBtn = false)
  12. {
  13. string strContent;
  14. switch (GlobalPara.CurrentLanguage)
  15. {
  16. case Language.English:
  17. strContent = EnglishContent;
  18. break;
  19. case Language.Chinese:
  20. strContent = ChineseContent;
  21. break;
  22. case Language.Other:
  23. strContent = OtherContent;
  24. break;
  25. default:
  26. strContent = ChineseContent;
  27. break;
  28. }
  29. if (MessageBox.Show(strContent, caption, msgbtn, msgicon,MessageBoxDefaultButton.Button2,0, bHelpBtn) == DialogResult.OK)
  30. {
  31. SaveLog("ErrorLog", ChineseContent);
  32. return true;
  33. }
  34. else
  35. {
  36. SaveLog("ErrorLog", ChineseContent);
  37. return false;
  38. }
  39. }
  40. public static void SaveLog(string strFileName, string strChinese)
  41. {
  42. string strDate;
  43. strDate = DateTime.Now.ToString("yyyyMMdd") + ".txt";
  44. string strFilePath = GlobalPara.ProDataFilePath + "\\Logs\\" + DateTime.Now.ToString("yyyy-MM-dd") + "\\";
  45. strFileName = strFileName + "_" + strDate;
  46. newLog.SaveTxt(strFilePath, strFileName, strChinese);
  47. }
  48. }
  49. }