1 refactor(config): 将AppSettings移至Application层并更新配置结构
2
3 - 将AppSettings从DMS.Infrastructure移至DMS.Application
4 - 将DatabaseSettings重命名为AppSettings.Database并更新所有引用
5 - 将配置文件从appSettings.json更改为dms_config.json
6 - 更新所有项目引用以使用新的AppSettings命名空间
7 - 移除DI容器中的SqlSugarDbContext直接实例化
8 - 添加Material Design Icons字体并更新设置视图UI
9 - 通过移除不必要的变量映射更新来优化S7服务
10 - 将数据库连接字符串属性名从Database更新为DbName
This commit is contained in:
@@ -7,8 +7,8 @@ using DMS.WPF.Services;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Threading.Tasks;
|
||||
using DMS.Application.Configurations;
|
||||
using DMS.Application.Services;
|
||||
using DMS.Infrastructure.Configurations;
|
||||
using DMS.WPF.Helper;
|
||||
using DMS.WPF.Interfaces;
|
||||
using DMS.WPF.Views;
|
||||
@@ -32,8 +32,9 @@ public partial class SplashViewModel : ObservableObject
|
||||
[ObservableProperty]
|
||||
private string _loadingMessage = "正在加载...";
|
||||
|
||||
public SplashViewModel(ILogger<SplashViewModel> logger,IServiceProvider serviceProvider, IInitializeService initializeService,IDataEventService dataEventService,
|
||||
IAppDataCenterService appDataCenterService,AppSettings appSettings)
|
||||
public SplashViewModel(ILogger<SplashViewModel> logger, IServiceProvider serviceProvider,
|
||||
IInitializeService initializeService, IDataEventService dataEventService,
|
||||
IAppDataCenterService appDataCenterService, AppSettings appSettings)
|
||||
{
|
||||
_logger = logger;
|
||||
_serviceProvider = serviceProvider;
|
||||
@@ -50,13 +51,18 @@ public partial class SplashViewModel : ObservableObject
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadingMessage = "正在加载系统配置...";
|
||||
if (_appSettings.Load() == null)
|
||||
{
|
||||
//程序第一次启动
|
||||
}
|
||||
|
||||
_logger.LogInformation("正在初始化数据库...");
|
||||
LoadingMessage = "正在初始化数据库...";
|
||||
_initializeService.InitializeTables();
|
||||
_initializeService.InitializeMenus();
|
||||
LoadingMessage = "正在加载系统配置...";
|
||||
|
||||
|
||||
|
||||
|
||||
await _appDataCenterService.DataLoaderService.LoadAllDataToMemoryAsync();
|
||||
|
||||
// 可以在这里添加加载配置的逻辑
|
||||
@@ -80,7 +86,7 @@ public partial class SplashViewModel : ObservableObject
|
||||
{
|
||||
// 处理初始化过程中的异常
|
||||
LoadingMessage = $"初始化失败: {ex.Message}";
|
||||
_logger.LogError(ex,$"初始化失败: {ex}");
|
||||
_logger.LogError(ex, $"初始化失败: {ex}");
|
||||
// 在此可以记录日志或显示错误对话框
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user