Program.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Reflection;
  7. using System.Windows.Forms;
  8. using DevExpress.LookAndFeel;
  9. using DevExpress.Skins;
  10. using DevExpress.UserSkins;
  11. using DevExpress.XtraEditors;
  12. namespace XdCxRhDW.Sender
  13. {
  14. internal static class Program
  15. {
  16. static Program()
  17. {
  18. AppDomain.CurrentDomain.SetData("PRIVATE_BINPATH", "AddIns;");
  19. var m = typeof(AppDomainSetup).GetMethod("UpdateContextProperty", BindingFlags.NonPublic | BindingFlags.Static);
  20. var funsion = typeof(AppDomain).GetMethod("GetFusionContext", BindingFlags.NonPublic | BindingFlags.Instance);
  21. m.Invoke(null, new object[] { funsion.Invoke(AppDomain.CurrentDomain, null), "PRIVATE_BINPATH", "AddIns;" });
  22. AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
  23. {
  24. var args = e.ExceptionObject as Exception;
  25. DxHelper.MsgBoxHelper.ShowError("出现未处理的异常,程序即将退出!");
  26. };
  27. Application.ThreadException += (sender, e) =>
  28. {
  29. DxHelper.MsgBoxHelper.ShowError(e.Exception.Message);
  30. };
  31. }
  32. /// <summary>
  33. /// The main entry point for the application.
  34. /// </summary>
  35. [STAThread]
  36. static void Main()
  37. {
  38. WindowsFormsSettings.AllowDpiScale = true;
  39. WindowsFormsSettings.AllowHoverAnimation = DevExpress.Utils.DefaultBoolean.True;
  40. WindowsFormsSettings.AllowDefaultSvgImages = DevExpress.Utils.DefaultBoolean.True;
  41. WindowsFormsSettings.AllowRoundedWindowCorners = DevExpress.Utils.DefaultBoolean.True;
  42. WindowsFormsSettings.AnimationMode = AnimationMode.EnableAll;
  43. WindowsFormsSettings.BackgroundSkinningMode = BackgroundSkinningMode.AllColors;
  44. WindowsFormsSettings.DefaultAllowHtmlDraw = true;
  45. WindowsFormsSettings.DefaultLookAndFeel.SetSkinStyle(SkinStyle.WXICompact);
  46. WindowsFormsSettings.DefaultFont = new System.Drawing.Font("微软雅黑", 10f);
  47. WindowsFormsSettings.SetPerMonitorDpiAware();
  48. if (Debugger.IsAttached)
  49. {
  50. //DevExpress23.2以上版本查看未本地化的资源
  51. //DevExpress.Utils.Localization.XtraLocalizer.EnableTraceSource();
  52. }
  53. Application.EnableVisualStyles();
  54. Application.SetCompatibleTextRenderingDefault(false);
  55. Application.Run(new Form1());
  56. }
  57. }
  58. }