增加公共操作的方法,过热度和过冷度的配置弹窗设置
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
<add key="PLCScan" value="600"/>
|
||||
<add key="PLCIP" value="127.0.0.1"/>
|
||||
<add key="FluidsPath" value="C:\Program Files (x86)\REFPROP\fluids"/>
|
||||
<add key="Cryogen" value="R134a"/>
|
||||
<add key="LocalDBPath" value="D:\MSDB\LocalDb\CapMachineDb"/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
@@ -100,6 +100,7 @@ namespace CapMachine.Wpf
|
||||
containerRegistry.RegisterSingleton<CanDriveService>();
|
||||
containerRegistry.RegisterSingleton<HighSpeedDataService>();
|
||||
containerRegistry.RegisterSingleton<PPCService>();
|
||||
containerRegistry.RegisterSingleton<ComActionService>();
|
||||
|
||||
|
||||
//注册AutoMapper 将IAutoMapperProvider注入IOC容器,并对外提供IMapper注入类型。
|
||||
@@ -159,6 +160,7 @@ namespace CapMachine.Wpf
|
||||
containerRegistry.RegisterDialog<DialogCanLinConfigCreateView, DialogCanLinConfigCreateViewModel>();
|
||||
containerRegistry.RegisterDialog<DialogPIDConfigView, DialogPIDConfigViewModel>();
|
||||
containerRegistry.RegisterDialog<DialogLimitConfigView, DialogLimitConfigViewModel>();
|
||||
containerRegistry.RegisterDialog<DialogSuperHeatCoolConfigView, DialogSuperHeatCoolConfigViewModel>();
|
||||
|
||||
|
||||
//注册AutoMapper
|
||||
@@ -232,6 +234,7 @@ namespace CapMachine.Wpf
|
||||
var appVersionService9 = ContainerLocator.Container.Resolve<DataRecordService>();
|
||||
var appVersionService10 = ContainerLocator.Container.Resolve<HighSpeedDataService>();
|
||||
var appVersionService11 = ContainerLocator.Container.Resolve<PPCService>();
|
||||
var appVersionService15 = ContainerLocator.Container.Resolve<ComActionService>();
|
||||
|
||||
|
||||
|
||||
|
||||
45
CapMachine.Wpf/Models/PPCalc/SuperHeatCoolConfigModel.cs
Normal file
45
CapMachine.Wpf/Models/PPCalc/SuperHeatCoolConfigModel.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Models.PPCalc
|
||||
{
|
||||
/// <summary>
|
||||
/// 过热度和过冷度的计算配置
|
||||
/// </summary>
|
||||
public class SuperHeatCoolConfigModel : BindableBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 制冷剂
|
||||
/// </summary>
|
||||
public string? Cryogen { get; set; }
|
||||
|
||||
private string _FluidsPath = "C:\\Program Files (x86)\\REFPROP\\fluids";
|
||||
/// <summary>
|
||||
/// 过热度和过冷度计算FLUID路径
|
||||
/// REFPROP
|
||||
/// REFPRP64.DLL
|
||||
///
|
||||
/// ****FluidsPath 路径不能太长,否则会导致错误***********
|
||||
/// </summary>
|
||||
public string FluidsPath
|
||||
{
|
||||
get { return _FluidsPath; }
|
||||
set { _FluidsPath = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 过热度和过冷度计算FLUID路径
|
||||
///// REFPROP
|
||||
///// REFPRP64.DLL
|
||||
/////
|
||||
///// ****FluidsPath 路径不能太长,否则会导致错误***********
|
||||
///// </summary>
|
||||
//public string FluidsPath { get; set; } = "C:\\Program Files (x86)\\REFPROP\\fluids";
|
||||
}
|
||||
}
|
||||
17
CapMachine.Wpf/PrismEvent/ComDialogEvent.cs
Normal file
17
CapMachine.Wpf/PrismEvent/ComDialogEvent.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Prism.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.PrismEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// 公共弹窗事件
|
||||
/// </summary>
|
||||
public class ComDialogEvent : PubSubEvent<ComDialogMsg>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
24
CapMachine.Wpf/PrismEvent/ComDialogMsg.cs
Normal file
24
CapMachine.Wpf/PrismEvent/ComDialogMsg.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.PrismEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// 公共弹窗消息
|
||||
/// </summary>
|
||||
public class ComDialogMsg
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///参数
|
||||
/// </summary>
|
||||
public object Par { get; set; }
|
||||
}
|
||||
}
|
||||
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,12 +13,16 @@ 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";
|
||||
}
|
||||
|
||||
@@ -16,11 +16,12 @@ namespace CapMachine.Wpf.ViewModels
|
||||
/// </summary>
|
||||
public class DialogExpInfoViewModel : DialogViewModel
|
||||
{
|
||||
public DialogExpInfoViewModel(ConfigService configService, IFreeSql freeSql, IMapper mapper, MachineRtDataService machineRtDataService)
|
||||
public DialogExpInfoViewModel(ConfigService configService, IFreeSql freeSql,PPCService pPCService, IMapper mapper, MachineRtDataService machineRtDataService)
|
||||
{
|
||||
this.Title = "试验信息拓展设置";
|
||||
ConfigService = configService;
|
||||
FreeSql = freeSql;
|
||||
PPCService = pPCService;
|
||||
this.Mapper = mapper;
|
||||
MachineRtDataService = machineRtDataService;
|
||||
|
||||
@@ -37,6 +38,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
/// FreeSql
|
||||
/// </summary>
|
||||
public IFreeSql FreeSql { get; }
|
||||
public PPCService PPCService { get; }
|
||||
|
||||
/// <summary>
|
||||
/// AutoMap映射
|
||||
@@ -140,7 +142,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
ExpInfoDtoItems.Add(new ExpInfoDto()
|
||||
{
|
||||
|
||||
RfNo = PPCService.SuperHeatCoolConfig.Cryogen,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
202
CapMachine.Wpf/ViewModels/DialogSuperHeatCoolConfigViewModel.cs
Normal file
202
CapMachine.Wpf/ViewModels/DialogSuperHeatCoolConfigViewModel.cs
Normal file
@@ -0,0 +1,202 @@
|
||||
using CapMachine.Core;
|
||||
using CapMachine.Wpf.Models;
|
||||
using CapMachine.Wpf.Models.PPCalc;
|
||||
using CapMachine.Wpf.Services;
|
||||
using Prism.Commands;
|
||||
using Prism.Services.Dialogs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Win32;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Forms;
|
||||
using NPOI.HPSF;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public class DialogSuperHeatCoolConfigViewModel : DialogViewModel
|
||||
{
|
||||
public DialogSuperHeatCoolConfigViewModel(PPCService pPCService)
|
||||
{
|
||||
Title = "过热度/过冷度设置";
|
||||
PPCService = pPCService;
|
||||
|
||||
SuperHeatCoolConfig = PPCService.SuperHeatCoolConfig;
|
||||
|
||||
CryogenComboBoxList = new List<ComboBoxModel>()
|
||||
{
|
||||
new ComboBoxModel(){Key="0",Text="R134a" },
|
||||
new ComboBoxModel(){Key="1",Text="R1234yf" },
|
||||
};
|
||||
}
|
||||
|
||||
private List<ComboBoxModel> _CryogenComboBoxList;
|
||||
/// <summary>
|
||||
/// 制冷剂下拉框列表
|
||||
/// </summary>
|
||||
public List<ComboBoxModel> CryogenComboBoxList
|
||||
{
|
||||
get { return _CryogenComboBoxList; }
|
||||
set { _CryogenComboBoxList = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前的过热度和过冷度的配置
|
||||
/// </summary>
|
||||
public SuperHeatCoolConfigModel SuperHeatCoolConfig { get; set; }
|
||||
|
||||
|
||||
private DelegateCommand _OpenSuperHeatCoolPathCmd;
|
||||
/// <summary>
|
||||
/// 打开过热度和过冷度的文件指令
|
||||
/// </summary>
|
||||
public DelegateCommand OpenSuperHeatCoolPathCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_OpenSuperHeatCoolPathCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_OpenSuperHeatCoolPathCmd == null)
|
||||
{
|
||||
_OpenSuperHeatCoolPathCmd = new DelegateCommand(() => OpenSuperHeatCoolPathCmdMethod());
|
||||
}
|
||||
return _OpenSuperHeatCoolPathCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 打开过热度和过冷度的文件文件信息
|
||||
/// </summary>
|
||||
private void OpenSuperHeatCoolPathCmdMethod()
|
||||
{
|
||||
//DbcFilePath
|
||||
try
|
||||
{
|
||||
var TargetFilePath = GetFilePath();
|
||||
if (!string.IsNullOrEmpty(TargetFilePath))
|
||||
{
|
||||
SuperHeatCoolConfig.FluidsPath = TargetFilePath;
|
||||
}
|
||||
//System.Diagnostics.Process.Start(fileName);//打开指定路径下的文件
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Windows.MessageBox.Show("可能未选择文件路径", "提示", System.Windows.MessageBoxButton.OKCancel, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取保存文件的路径
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetFilePath()
|
||||
{
|
||||
using (var folderBrowserDialog = new FolderBrowserDialog())
|
||||
{
|
||||
folderBrowserDialog.Description = "请选择一个文件夹";
|
||||
folderBrowserDialog.ShowNewFolderButton = true;
|
||||
|
||||
if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
string selectedPath = folderBrowserDialog.SelectedPath;
|
||||
// 处理选中的文件夹路径
|
||||
return selectedPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string name;
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get { return name; }
|
||||
set { name = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
private DelegateCommand saveCmd;
|
||||
/// <summary>
|
||||
/// 保存命令
|
||||
/// </summary>
|
||||
public DelegateCommand SaveCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
saveCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (saveCmd == null)
|
||||
{
|
||||
saveCmd = new DelegateCommand(() => SaveCmdMethod());
|
||||
}
|
||||
return saveCmd;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存命令方法
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void SaveCmdMethod()
|
||||
{
|
||||
DialogParameters pars = new DialogParameters
|
||||
{
|
||||
{ "Name", Name }
|
||||
};
|
||||
|
||||
RaiseRequestClose(new Prism.Services.Dialogs.DialogResult(ButtonResult.OK, pars));
|
||||
}
|
||||
|
||||
private DelegateCommand cancelCmd;
|
||||
/// <summary>
|
||||
/// 保存命令
|
||||
/// </summary>
|
||||
public DelegateCommand CancelCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
cancelCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (cancelCmd == null)
|
||||
{
|
||||
cancelCmd = new DelegateCommand(() => CancelCmdMethod());
|
||||
}
|
||||
return cancelCmd;
|
||||
}
|
||||
}
|
||||
|
||||
public PPCService PPCService { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 取消命令方法
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void CancelCmdMethod()
|
||||
{
|
||||
RaiseRequestClose(new Prism.Services.Dialogs.DialogResult(ButtonResult.Cancel));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 窗口打开时的传递的参数
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
public override void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
//Name = parameters.GetValue<string>("Name");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,29 @@
|
||||
using CapMachine.Core;
|
||||
using CapMachine.Core.IService;
|
||||
using CapMachine.Wpf.Models;
|
||||
using CapMachine.Wpf.PrismEvent;
|
||||
using CapMachine.Wpf.Services;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
public class MainViewModel : NavigationViewModel
|
||||
{
|
||||
public MainViewModel(IRegionManager region, INavigationMenuService menuService, SysRunService sysService)
|
||||
public MainViewModel(IRegionManager region, INavigationMenuService menuService, SysRunService sysService, IEventAggregator eventAggregator)
|
||||
{
|
||||
this.region = region;
|
||||
MenuService = menuService;
|
||||
SysService = sysService;
|
||||
EventAggregator = eventAggregator;
|
||||
NavigateCommand = new DelegateCommand<NavigationItem>(Navigate);
|
||||
}
|
||||
|
||||
public INavigationMenuService MenuService { get; }
|
||||
public SysRunService SysService { get; }
|
||||
public IEventAggregator EventAggregator { get; }
|
||||
public DelegateCommand<NavigationItem> NavigateCommand { get; private set; }
|
||||
|
||||
private int selectedIndex = -1;
|
||||
@@ -59,6 +64,38 @@ namespace CapMachine.Wpf.ViewModels
|
||||
IsTopDrawerOpen = false;
|
||||
}
|
||||
|
||||
private DelegateCommand<string> _TopDrawerCmd;
|
||||
/// <summary>
|
||||
/// 顶部弹窗按钮命令
|
||||
/// </summary>
|
||||
public DelegateCommand<string> TopDrawerCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_TopDrawerCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_TopDrawerCmd == null)
|
||||
{
|
||||
_TopDrawerCmd = new DelegateCommand<string>((p) => TopDrawerCmdCall(p));
|
||||
}
|
||||
return _TopDrawerCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 弹窗数据
|
||||
/// </summary>
|
||||
/// <param name="p"></param>
|
||||
private void TopDrawerCmdCall(string Name)
|
||||
{
|
||||
//测试数据
|
||||
IsTopDrawerOpen = false;
|
||||
|
||||
EventAggregator.GetEvent<ComDialogEvent>().Publish(new ComDialogMsg() { Name = Name, Par = null });
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 导航到页面信息
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
/// <param name="machineRtDataService"></param>
|
||||
/// <param name="dialogService"></param>
|
||||
public MonitorViewModel(ConfigService configService, IEventAggregator eventAggregator,
|
||||
DataRecordService dataRecordService, SysRunService sysRunService, AlarmService alarmService,
|
||||
DataRecordService dataRecordService, SysRunService sysRunService, AlarmService alarmService,PPCService pPCService,
|
||||
MachineRtDataService machineRtDataService, IDialogService dialogService)
|
||||
{
|
||||
ConfigService = configService;
|
||||
@@ -35,6 +35,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
DataRecordService = dataRecordService;
|
||||
SysRunServer = sysRunService;
|
||||
AlarmService = alarmService;
|
||||
PPCService = pPCService;
|
||||
MachineRtDataService = machineRtDataService;
|
||||
DialogService = dialogService;
|
||||
TagManager = MachineRtDataService.TagManger;
|
||||
@@ -69,6 +70,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
public DataRecordService DataRecordService { get; }
|
||||
public SysRunService SysRunServer { get; }
|
||||
public AlarmService AlarmService { get; }
|
||||
public PPCService PPCService { get; }
|
||||
public MachineRtDataService MachineRtDataService { get; }
|
||||
public IDialogService DialogService { get; }
|
||||
public List<ChartRtValue> ListChartRtValue { get; set; } = new List<ChartRtValue>()
|
||||
@@ -244,6 +246,9 @@ namespace CapMachine.Wpf.ViewModels
|
||||
case "试验信息":
|
||||
ShowDialogExpInfo();
|
||||
break;
|
||||
case "SuperHeatCool":
|
||||
//ShowSuperHeatCool();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -441,7 +446,9 @@ namespace CapMachine.Wpf.ViewModels
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 试验信息弹窗
|
||||
/// </summary>
|
||||
private void ShowDialogExpInfo()
|
||||
{
|
||||
//弹窗
|
||||
@@ -463,6 +470,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取曲线的实时值
|
||||
/// 数据是发布过来
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text="" />
|
||||
Text=" " />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
|
||||
122
CapMachine.Wpf/Views/DialogSuperHeatCoolConfigView.xaml
Normal file
122
CapMachine.Wpf/Views/DialogSuperHeatCoolConfigView.xaml
Normal file
@@ -0,0 +1,122 @@
|
||||
<UserControl
|
||||
x:Class="CapMachine.Wpf.Views.DialogSuperHeatCoolConfigView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:CapMachine.Wpf.Views"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
Width="1000"
|
||||
Height="300"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
|
||||
|
||||
<TextBlock
|
||||
Margin="10,0,10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="30"
|
||||
Foreground="DimGray"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
Margin="5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="30"
|
||||
FontWeight="Bold"
|
||||
Foreground="DimGray"
|
||||
Text="Fluids 文件路径:" />
|
||||
<Border
|
||||
Width="500"
|
||||
Margin="5,8"
|
||||
Padding="15,5"
|
||||
Background="LightGray"
|
||||
CornerRadius="5">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="22"
|
||||
Text="{Binding SuperHeatCoolConfig.FluidsPath}" />
|
||||
</Border>
|
||||
|
||||
<Button Command="{Binding OpenSuperHeatCoolPathCmd}" Foreground="White">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="18"
|
||||
Text=" " />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="选择Fluids文件" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
|
||||
<TextBlock
|
||||
Margin="10,0,10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="30"
|
||||
Foreground="DimGray"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
Margin="5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="30"
|
||||
FontWeight="Bold"
|
||||
Foreground="DimGray"
|
||||
Text="冷媒选择:" />
|
||||
<ComboBox
|
||||
Width="180"
|
||||
Margin="10,0"
|
||||
HorizontalAlignment="Center"
|
||||
HorizontalContentAlignment="Center"
|
||||
materialDesign:HintAssist.Hint="冷媒选择"
|
||||
DisplayMemberPath="Text"
|
||||
FontSize="20"
|
||||
FontWeight="Bold"
|
||||
ItemsSource="{Binding CryogenComboBoxList}"
|
||||
SelectedValue="{Binding SuperHeatCoolConfig.Cryogen}"
|
||||
SelectedValuePath="Text" />
|
||||
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="10,10"
|
||||
Command="{Binding SaveCmd}"
|
||||
Content="确定"
|
||||
Foreground="White" />
|
||||
<Button
|
||||
Margin="10,0"
|
||||
Command="{Binding CancelCmd}"
|
||||
Content="取消"
|
||||
Foreground="White" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
CapMachine.Wpf/Views/DialogSuperHeatCoolConfigView.xaml.cs
Normal file
28
CapMachine.Wpf/Views/DialogSuperHeatCoolConfigView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace CapMachine.Wpf.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// DialogSuperHeatCoolConfigView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class DialogSuperHeatCoolConfigView : UserControl
|
||||
{
|
||||
public DialogSuperHeatCoolConfigView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:CapMachine.Wpf.Views"
|
||||
xmlns:localEx="clr-namespace:CapMachine.Wpf"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
@@ -19,6 +20,9 @@
|
||||
WindowState="Maximized"
|
||||
WindowStyle="SingleBorderWindow"
|
||||
mc:Ignorable="d">
|
||||
<Window.Resources>
|
||||
<localEx:BindingProxy x:Key="Proxy" Data="{Binding}" />
|
||||
</Window.Resources>
|
||||
<!--<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="StateChanged">
|
||||
<prism:InvokeCommandAction Command="{Binding WindowStateChangedCmd}" CommandParameter="{Binding ElementName=MainDatagrid, Path=SelectedItem}" />
|
||||
@@ -179,7 +183,11 @@
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Button Height="40" Margin="5">
|
||||
<Button
|
||||
Height="40"
|
||||
Margin="5"
|
||||
Command="{Binding Source={StaticResource Proxy}, Path=Data.TopDrawerCmd}"
|
||||
CommandParameter="{Binding Name}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Margin="10,5" Text="{Binding Name}" />
|
||||
</StackPanel>
|
||||
|
||||
@@ -450,6 +450,22 @@
|
||||
CommandParameter="{x:Static Dock.Left}"
|
||||
Content="{materialDesign:PackIcon Kind=ArrowUp}"
|
||||
Foreground="White" />
|
||||
<Button
|
||||
Margin="5,0"
|
||||
Command="{Binding OperCmd}"
|
||||
CommandParameter="SuperHeatCool"
|
||||
Foreground="White">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="/Assets/Fonts/#iconfont"
|
||||
FontSize="14"
|
||||
Foreground="White"
|
||||
Text="" />
|
||||
<TextBlock Text="过热度过冷度" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</materialDesign:Card>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user