增加公共操作的方法,过热度和过冷度的配置弹窗设置
This commit is contained in:
95
CapMachine.Wpf/Services/ComActionService.cs
Normal file
95
CapMachine.Wpf/Services/ComActionService.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
using CapMachine.Model;
|
||||
using CapMachine.Wpf.Dtos;
|
||||
using CapMachine.Wpf.PrismEvent;
|
||||
using Prism.Events;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Services.Dialogs;
|
||||
|
||||
namespace CapMachine.Wpf.Services
|
||||
{
|
||||
@@ -10,11 +13,15 @@ namespace CapMachine.Wpf.Services
|
||||
/// </summary>
|
||||
public class ConfigService : BindableBase
|
||||
{
|
||||
public ConfigService()
|
||||
public ConfigService(IEventAggregator eventAggregator, IDialogService dialogService)
|
||||
{
|
||||
CurUserDto = new UserDto();
|
||||
|
||||
|
||||
EventAggregator = eventAggregator;
|
||||
|
||||
DialogService = dialogService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Csv文件锁
|
||||
@@ -98,5 +105,13 @@ namespace CapMachine.Wpf.Services
|
||||
set { _CurUserDto = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
public IEventAggregator EventAggregator { get; }
|
||||
public PPCService PPCService { get; }
|
||||
public IDialogService DialogService { get; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,27 +28,27 @@ namespace CapMachine.Wpf.Services
|
||||
MenuItems.Clear();
|
||||
MenuItems.Add(new NavigationItem("", "系统", "", new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("","系统配置","",new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("ShapeCirclePlus","日志文件",""),
|
||||
new NavigationItem("","快速工况","QuickMeterStepView"),
|
||||
new NavigationItem("Clouds", "高速记录",""),
|
||||
new NavigationItem("ShapeOvalPlus","系统配置",""),
|
||||
}),
|
||||
//new NavigationItem("","系统配置","",new ObservableCollection<NavigationItem>()
|
||||
//{
|
||||
// new NavigationItem("ShapeCirclePlus","日志文件",""),
|
||||
// new NavigationItem("","快速工况","QuickMeterStepView"),
|
||||
// new NavigationItem("Clouds", "高速记录",""),
|
||||
// new NavigationItem("ShapeOvalPlus","系统配置",""),
|
||||
//}),
|
||||
new NavigationItem("", "计算信息","",new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("Circle","过热度",""),
|
||||
new NavigationItem("Palette","过冷度",""),
|
||||
}),
|
||||
new NavigationItem("", "PID设置","",new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("Circle","转速PID",""),
|
||||
}),
|
||||
new NavigationItem("", "通信配置","",new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("Circle","CAN配置","CANConfigView"),
|
||||
new NavigationItem("Circle","LIN配置",""),
|
||||
new NavigationItem("SuperHeatCool","过热度/过冷度配置","DialogSuperHeatCoolConfigView"),
|
||||
//new NavigationItem("Palette","过冷度",""),
|
||||
}),
|
||||
//new NavigationItem("", "PID设置","",new ObservableCollection<NavigationItem>()
|
||||
//{
|
||||
// new NavigationItem("Circle","转速PID",""),
|
||||
//}),
|
||||
//new NavigationItem("", "通信配置","",new ObservableCollection<NavigationItem>()
|
||||
//{
|
||||
// new NavigationItem("Circle","CAN配置","CANConfigView"),
|
||||
// new NavigationItem("Circle","LIN配置",""),
|
||||
//}),
|
||||
new NavigationItem("","版本信息","",new ObservableCollection<NavigationItem>()
|
||||
{
|
||||
new NavigationItem("FormatColorText", "操作手册",""),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using CapMachine.Core;
|
||||
using CapMachine.Shared.Controls;
|
||||
using CapMachine.Wpf.Models.PPCalc;
|
||||
using CapMachine.Wpf.Models.Tag;
|
||||
using CapMachine.Wpf.PPCalculation;
|
||||
using Prism.Events;
|
||||
@@ -66,20 +67,26 @@ namespace CapMachine.Wpf.Services
|
||||
//Cond1TempTag = TagManager.DicTags.GetValueOrDefault("冷凝器出口水温[℃]");
|
||||
//CondInTempTag = TagManager.DicTags.GetValueOrDefault("冷凝器进口温度[℃]");
|
||||
|
||||
FluidsPath = ConfigHelper.GetValue("FluidsPath");
|
||||
SuperHeatCoolConfig.FluidsPath = ConfigHelper.GetValue("FluidsPath");
|
||||
SuperHeatCoolConfig.Cryogen = ConfigHelper.GetValue("Cryogen");
|
||||
|
||||
RtScanDeviceStart();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 过热度和过冷度计算FLUID路径
|
||||
/// REFPROP
|
||||
/// REFPRP64.DLL
|
||||
///
|
||||
/// ****FluidsPath 路径不能太长,否则会导致错误***********
|
||||
/// 当前的配置
|
||||
/// </summary>
|
||||
public string FluidsPath { get; set; } = "C:\\Program Files (x86)\\REFPROP\\fluids";
|
||||
public SuperHeatCoolConfigModel SuperHeatCoolConfig { get; set; } = new SuperHeatCoolConfigModel();
|
||||
|
||||
/// <summary>
|
||||
/// 保存配置信息
|
||||
/// </summary>
|
||||
public void SaveSuperHeatCoolConfig()
|
||||
{
|
||||
ConfigHelper.SetValue("FluidsPath", SuperHeatCoolConfig.FluidsPath);
|
||||
ConfigHelper.SetValue("Cryogen", SuperHeatCoolConfig.Cryogen);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 吸气压力
|
||||
@@ -112,10 +119,10 @@ namespace CapMachine.Wpf.Services
|
||||
/// </summary>
|
||||
public double Subcool { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 制冷剂
|
||||
/// </summary>
|
||||
public string Cryogen { get; set; } = "R134a";
|
||||
///// <summary>
|
||||
///// 制冷剂
|
||||
///// </summary>
|
||||
//public string Cryogen { get; set; } = "R134a";
|
||||
|
||||
/// <summary>
|
||||
/// 风量数据-乘以系数的后的最终结果
|
||||
@@ -164,7 +171,7 @@ namespace CapMachine.Wpf.Services
|
||||
|
||||
//textBox5.Text = "";
|
||||
|
||||
string hpath = FluidsPath;
|
||||
string hpath = SuperHeatCoolConfig.FluidsPath;
|
||||
long size = hpath.Length;
|
||||
|
||||
hpath += new String(' ', 255 - (int)size);
|
||||
@@ -173,7 +180,7 @@ namespace CapMachine.Wpf.Services
|
||||
long numComps = 1;//冷媒个数
|
||||
//string hfld = "R1234YF.FLD"; R1234YF
|
||||
string hfld = "";
|
||||
if (Cryogen == "R134a")
|
||||
if (SuperHeatCoolConfig.Cryogen == "R134a")
|
||||
{
|
||||
hfld = "R134A.FLD";
|
||||
}
|
||||
@@ -269,7 +276,7 @@ namespace CapMachine.Wpf.Services
|
||||
//string hfld = "R1234YF.FLD";
|
||||
//string hfld = "R134A.FLD";
|
||||
string hfld = "";
|
||||
if (Cryogen == "R134a")
|
||||
if (SuperHeatCoolConfig.Cryogen == "R134a")
|
||||
{
|
||||
hfld = "R134A.FLD";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user