Pārlūkot izejas kodu

日志更新

样式分支
fyf pirms 2 gadiem
vecāks
revīzija
bc51448627
2 mainītis faili ar 18 papildinājumiem un 6 dzēšanām
  1. +2
    -2
      BPASmartClient.Message/MessageLog.cs
  2. +16
    -4
      BPASmartClient.ViewModel/LogViewModel.cs

+ 2
- 2
BPASmartClient.Message/MessageLog.cs Parādīt failu

@@ -66,7 +66,7 @@ namespace BPASmartClient.Message
/// <summary>
/// 设备过程日志委托
/// </summary>
public Action<string> DeviceProcessLogNotify { get; set; }
public Action<string, string> DeviceProcessLogNotify { get; set; }

/// <summary>
/// 设备日志信息字典
@@ -84,7 +84,7 @@ namespace BPASmartClient.Message
DPLogInfo.TryAdd(id, info);
Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}");
//ExLogInfo = $"{DateTime.Now.ToString("HH:mm:ss")}:{info} \n\r {ExLogInfo}";
if (DeviceProcessLogNotify != null) DeviceProcessLogNotify(info);
if (DeviceProcessLogNotify != null) DeviceProcessLogNotify(id,info);
}
}
#endregion


+ 16
- 4
BPASmartClient.ViewModel/LogViewModel.cs Parādīt failu

@@ -44,12 +44,10 @@ namespace BPASmartClient.ViewModel
public static LogViewModel GetInstance() => _Instance ?? (_Instance = new LogViewModel());
private LogViewModel()
{
//3.初始化日志
logHelper.Fun_InitLog(System.AppDomain.CurrentDomain.BaseDirectory);
if (LogDataGrid==null) LogDataGrid = new ObservableCollection<LogModel>();

if (LogDataGrid==null)
LogDataGrid = new ObservableCollection<LogModel>();
//一般日志
MessageLog.GetInstance.InfoNotify = new Action<string>((s) =>
{
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
@@ -58,6 +56,18 @@ namespace BPASmartClient.ViewModel
logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO, s);
}));
});

//设备日志
MessageLog.GetInstance.DeviceProcessLogNotify = new Action<string,string>((id,s) =>
{
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
{
LogDataGrid.Insert(0, new LogModel { message = s, type = "DeviceLog" });
logHelper.GetLogConfigInstance().WriteLog(LogLevel.DEBUG, s);
}));
});

//错误日志
MessageLog.GetInstance.ExInfoNotify = new Action<string>((s) =>
{
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
@@ -74,6 +84,8 @@ namespace BPASmartClient.ViewModel
});
}));
});


ExcelCommand = new RelayCommand(() =>
{
ExcellOrder();


Notiek ielāde…
Atcelt
Saglabāt