将Logger都更改为使用NLogHelper
This commit is contained in:
@@ -19,7 +19,7 @@ public partial class DevicesViewModel : ViewModelBase
|
||||
private readonly DataServices _dataServices;
|
||||
private readonly IDialogService _dialogService;
|
||||
private readonly DeviceRepository _deviceRepository;
|
||||
private readonly ILogger<DevicesViewModel> _logger;
|
||||
|
||||
private readonly MenuRepository _menuRepository;
|
||||
private readonly VarTableRepository _varTableRepository;
|
||||
|
||||
@@ -42,13 +42,13 @@ public partial class DevicesViewModel : ViewModelBase
|
||||
/// <param name="dialogService">对话框服务。</param>
|
||||
/// <param name="dataServices">数据服务。</param>
|
||||
public DevicesViewModel(
|
||||
ILogger<DevicesViewModel> logger, IDialogService dialogService, DataServices dataServices
|
||||
IDialogService dialogService, DataServices dataServices
|
||||
)
|
||||
{
|
||||
_deviceRepository = new DeviceRepository();
|
||||
_varTableRepository = new VarTableRepository();
|
||||
_menuRepository = new MenuRepository();
|
||||
_logger = logger;
|
||||
|
||||
_dialogService = dialogService;
|
||||
_dataServices = dataServices;
|
||||
|
||||
@@ -69,7 +69,7 @@ public partial class DevicesViewModel : ViewModelBase
|
||||
// 如果用户取消或对话框未返回设备,则直接返回
|
||||
if (device == null)
|
||||
{
|
||||
_logger.LogInformation("用户取消了添加设备操作。");
|
||||
NlogHelper.Info("用户取消了添加设备操作。");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,20 +3,17 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using PMSWPF.Data.Repositories;
|
||||
using PMSWPF.Enums;
|
||||
using PMSWPF.Extensions;
|
||||
using PMSWPF.Helper;
|
||||
using PMSWPF.Models;
|
||||
using PMSWPF.Services;
|
||||
using ILogger = Microsoft.Extensions.Logging.ILogger;
|
||||
|
||||
namespace PMSWPF.ViewModels;
|
||||
|
||||
partial class VariableTableViewModel : ViewModelBase
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly IDialogService _dialogService;
|
||||
|
||||
// private readonly ILogger<VariableTableViewModel> _logger;
|
||||
@@ -174,7 +171,7 @@ partial class VariableTableViewModel : ViewModelBase
|
||||
processingDialog?.Hide();
|
||||
|
||||
string msgSuccess = $"成功导入变量:{resVarDataCount}个。";
|
||||
Logger.Info(msgSuccess);
|
||||
NlogHelper.Info(msgSuccess);
|
||||
NotificationHelper.ShowSuccess(msgSuccess);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user