Program.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using DevExpress.LookAndFeel;
  2. using DevExpress.XtraEditors;
  3. using Microsoft.Win32;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Diagnostics;
  7. using System.IO;
  8. using System.Reflection;
  9. using System.Security.Principal;
  10. using System.Windows.Forms;
  11. using DW5S.WebApi;
  12. using DW5S.Repostory;
  13. using DW5S.Entity;
  14. using System.Runtime.Loader;
  15. using DW5S.App;
  16. using System.Runtime.CompilerServices;
  17. namespace DW5S
  18. {
  19. internal static class Program
  20. {
  21. /// <summary>
  22. /// 应用程序的主入口点。
  23. /// </summary>
  24. [STAThread]
  25. static void Main()
  26. {
  27. var title = AppConfigHelper.Get("SystemName", "定位平台");
  28. AppHelper.OneStart(title, () =>
  29. {
  30. string screenCompany = AppConfigHelper.Get("Company", "");
  31. DxHelper.WaitHelper.SetSplashTips("Tips.txt");
  32. DxHelper.WaitHelper.ShowSplashScreen(title, screenCompany);
  33. DxHelper.WaitHelper.UpdateSplashMessage("正在加载程序资源文件...");
  34. System.Windows.Forms.Application.ThreadException += Application_ThreadException;
  35. MainForm mainForm = new MainForm() { Text = title };
  36. DxHelper.WaitHelper.UpdateSplashMessage("正在初始化...");
  37. System.Windows.Forms.Application.Run(mainForm);
  38. });
  39. }
  40. private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
  41. {
  42. IocContainer.Logger.Error(e.Exception, e.Exception.Message);
  43. DxHelper.MsgBoxHelper.ShowError($"检测到异常,请联系管理员,异常信息:{e.Exception.Message}");
  44. }
  45. }
  46. }