96 lines
2.7 KiB
C#
96 lines
2.7 KiB
C#
using CapMachine.Wpf.PrismEvent;
|
|
using Prism.Events;
|
|
using Prism.Services.Dialogs;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace CapMachine.Wpf.Services
|
|
{
|
|
|
|
/// <summary>
|
|
/// 公共操作的服务
|
|
/// 存放公共事件的服务
|
|
/// </summary>
|
|
public class ComActionService
|
|
{
|
|
public ConfigService ConfigService { get; }
|
|
|
|
private IEventAggregator EventAggregator { get; set; }
|
|
public DataRecordService DataRecordService { get; }
|
|
public SysRunService SysRunServer { get; }
|
|
public PPCService PPCService { get; }
|
|
public MachineRtDataService MachineRtDataService { get; }
|
|
public IDialogService DialogService { get; }
|
|
|
|
|
|
public ComActionService(ConfigService configService, IEventAggregator eventAggregator,
|
|
DataRecordService dataRecordService, SysRunService sysRunService,PPCService pPCService,
|
|
MachineRtDataService machineRtDataService, IDialogService dialogService)
|
|
{
|
|
ConfigService = configService;
|
|
//事件服务
|
|
EventAggregator = eventAggregator;
|
|
DataRecordService = dataRecordService;
|
|
SysRunServer = sysRunService;
|
|
PPCService = pPCService;
|
|
MachineRtDataService = machineRtDataService;
|
|
DialogService = dialogService;
|
|
|
|
EventAggregator.GetEvent<ComDialogEvent>().Subscribe(ComDialogEventCall);
|
|
}
|
|
|
|
|
|
|
|
#region 公共弹窗操作
|
|
|
|
/// <summary>
|
|
/// 公共弹窗事件执行方法
|
|
/// </summary>
|
|
/// <param name="msg"></param>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
private void ComDialogEventCall(ComDialogMsg msg)
|
|
{
|
|
switch (msg.Name)
|
|
{
|
|
case "过热度/过冷度配置":
|
|
ShowSuperHeatCool(msg.Par);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 过热度和过冷度配置弹窗
|
|
/// </summary>
|
|
private void ShowSuperHeatCool(object par)
|
|
{
|
|
//弹窗
|
|
DialogService.ShowDialog("DialogSuperHeatCoolConfigView", new DialogParameters() { { "Name", par } }, (par) =>
|
|
{
|
|
if (par.Result == ButtonResult.OK)
|
|
{
|
|
//保存配置信息
|
|
PPCService.SaveSuperHeatCoolConfig();
|
|
|
|
|
|
}
|
|
else if (par.Result == ButtonResult.Cancel)
|
|
{
|
|
//取消
|
|
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
|
|
#endregion
|
|
}
|
|
}
|