protected override void OnStartup(StartupEventArgs e) { try { #region 全局异常捕获 //注册全局异常处理 DispatcherUnhandledException += App_DispatcherUnhandledException; #endregion LicenceHelper.SoftName = "捷普流水线读码系统"; LicenceHelper.SoftCode = "JPLSXDMXT_OUT"; if (!LicenceHelper.IsReg) { return; } LogHelper.Init(LogInfo.Log, LogError.Log, LogTrace.Log, LogRead.Log, LogPOSTJGP.Log, LogPOSTIFactory.Log); ConfigHelper.Init(); Config = ConfigHelper.GetConfig <ConfigModel>(); Settings = new SettingsModel(); #region 初始化数据库 new DbContext().DdAsyn(); Settings.Load(); #endregion base.OnStartup(e); } catch (Exception ex) { LogError.Log.Error("未捕获异常", ex); MessageBox.Show(ex.Message, "启动失败", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(0); } }
void LoadSetting() { Settings = db.SettingsDb.GetList(); SettingsModel.Load(); OnPropertyChanged(nameof(Settings)); OnPropertyChanged(nameof(SettingsModel)); }