整理了错误的捕捉

关闭窗口验证
This commit is contained in:
2025-07-10 18:00:31 +08:00
parent fdd321e635
commit 4e8c66aa38
17 changed files with 368 additions and 95 deletions

View File

@@ -1,4 +1,5 @@
using CapMachine.Wpf.Models;
using CapMachine.Wpf.PrismEvent;
using Prism.Events;
using Prism.Mvvm;
using System;
@@ -10,11 +11,11 @@ using System.Threading.Tasks;
namespace CapMachine.Wpf.Services
{
/// <summary>
/// 系统
/// 系统运行服务
/// </summary>
public class SysRunService : BindableBase
{
public SysRunService(IEventAggregator eventAggregator,ConfigService configService,CanDriveService canDriveService,LinDriveService linDriveService)
public SysRunService(IEventAggregator eventAggregator, ConfigService configService, CanDriveService canDriveService, LinDriveService linDriveService)
{
// 创建一个定时器设置间隔时间为2000毫秒即2秒
CurTimer = new System.Timers.Timer(5000);
@@ -28,10 +29,27 @@ namespace CapMachine.Wpf.Services
ConfigService = configService;
CanDriveService = canDriveService;
LinDriveService = linDriveService;
MachineRunState1 = new MachineRunState("M1", EventAggregator, ConfigService,canDriveService,linDriveService);
MachineRunState1 = new MachineRunState("M1", EventAggregator, ConfigService, canDriveService, linDriveService);
EventAggregator.GetEvent<ErrStateEvent>().Subscribe(ErrStateAction);
}
/// <summary>
/// 错误状态处理方法
/// </summary>
/// <param name="msg"></param>
/// <exception cref="NotImplementedException"></exception>
private void ErrStateAction(ErrStateMsg errStateMsg)
{
SysErrStateInfo.ActiveErr(errStateMsg.ErrMsg!);
}
/// <summary>
/// 系统错误状态
/// </summary>
public SysErrState SysErrStateInfo { get; set; } = new SysErrState();
/// <summary>
/// 设备运行状态
/// </summary>