選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Bootstrapper.cs 2.2 KiB

2年前
2年前
2年前
2年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using HandyControl.Controls;
  2. using HKCardIN.ViewModels;
  3. using Stylet;
  4. using StyletIoC;
  5. using System;
  6. using System.Configuration;
  7. using System.Windows.Controls;
  8. using System.Windows.Threading;
  9. using System.Windows;
  10. using Microsoft.Extensions.Configuration;
  11. using HKCardIN.Helper;
  12. namespace HKCardIN
  13. {
  14. public class Bootstrapper : Bootstrapper<RootViewModel>
  15. {
  16. /// <summary>
  17. /// 程序启动
  18. /// </summary>
  19. protected override void OnStart()
  20. {
  21. HKLog.HKLogImport.Init("HKCardIN");
  22. }
  23. protected override void ConfigureIoC(IStyletIoCBuilder builder)
  24. {
  25. }
  26. /// <summary>
  27. /// 初始化系统相关参数配置
  28. /// </summary>
  29. protected override void Configure()
  30. {
  31. var configer = (new ConfigurationBuilder()).AddJsonFile("options.json").Build();
  32. DataBus.SaasRoute = configer["SaasRoute"];
  33. DataBus.LockCode = configer["LockCode"];
  34. base.Configure();
  35. }
  36. /// <summary>
  37. /// 初始化VM
  38. /// </summary>
  39. protected override void Launch()
  40. {
  41. base.Launch();
  42. }
  43. /// <summary>
  44. /// 加载首页VM
  45. /// </summary>
  46. /// <param name="rootViewModel"></param>
  47. protected override void DisplayRootView(object rootViewModel)
  48. {
  49. base.DisplayRootView(rootViewModel);
  50. }
  51. /// <summary>
  52. ///VM加载完毕
  53. /// </summary>
  54. protected override void OnLaunch()
  55. {
  56. base.OnLaunch();
  57. }
  58. /// <summary>
  59. /// 退出
  60. /// </summary>
  61. /// <param name="e"></param>
  62. protected override void OnExit(ExitEventArgs e)
  63. {
  64. base.OnExit(e);
  65. }
  66. /// <summary>
  67. /// 全局异常捕获
  68. /// </summary>
  69. /// <param name="e"></param>
  70. protected override void OnUnhandledException(DispatcherUnhandledExceptionEventArgs e)
  71. {
  72. HKLog.HKLogImport.WriteError(e.Exception.InnerException != null ? e.Exception.InnerException : e.Exception);
  73. GC.Collect();
  74. }
  75. }
  76. }